Sponsored Content
Full Discussion: Unexpected End Of File Error
Top Forums Shell Programming and Scripting Unexpected End Of File Error Post 302674007 by spooke on Wednesday 18th of July 2012 08:06:55 PM
Old 07-18-2012
Unexpected End Of File Error

Hi guys,

I am new to BASH scripting and I was wondering if anyone could have a look at this code and explain to me why I am getting an Unexpected End of File Error ?

If you can that would be great / much appreciated! THANKS!

Code:
#!/bin/bash
USER=""
PASS=""
if [ -z "$PASS" ]; then echo "You need to set your username and password in the script."; exit 1; fi
wget -q -O .login.html http://www.hackthissite.org/user/login  --post-data="username=$USER&password=$PASS&btn_submit=Login"  --save-cookies=.cookies.txt --keep-session-cookies --referer  http://www.hackthissite.org/
grep "Image Validation" .login.html >/dev/null && echo  "Error: You need to log out/in in a web browser" && exit 1
wget -q -O -  http://www.hackthissite.org/missions/prog/11/   --load-cookies=.cookies.txt --keep-session-cookies --referer  http://www.hackthissite.org/missions/programming/ > out.txt

TEXT=`cat out.txt | grep "Generated String:" | cut -f 2 -d : | cut -f 1 -d "<" | tr -d [:blank:]`
SHIFT=`cat out.txt | grep "Generated String:" | cut -f 3 -d : | cut -f 1 -d "<" | tr -d [:blank:]`

echo "If this doesn't work, you'll need to add this separator:"
echo $TEXT

for EACH in `echo $TEXT | tr "," "\n" | tr ")" "\n" | tr "#" "\n"| tr  "'" "\n"| tr "." "\n"| tr "&" "\n"| tr "(" "\n"| tr "!" "\n"| tr "%"  "\n"| tr "$" "\n"| tr "+" "\n"| tr "-" "\n"| tr "/" "\n"| tr "*" "\n"|  tr "@" "\n"| tr "^" "\n"| tr "\"" "\n"`
do 
let EACH=$EACH-$SHIFT
STRING="$STRING$(printf "\\$(printf "%03o" $EACH)")"
done
echo The string is $STRING
wget -q -O -  http://www.hackthissite.org/missions/prog/11/index.php  --post-data="solution=$STRING"  --load-cookies=.cookies.txt  --keep-session-cookies --referer  http://www.hackthissite.org/missions/prog/11/ > out2.txt
grep "answer is wrong" out2.txt | html2text
grep -i "successfully" out2.txt | html2text
grep -i "already completed" out2.txt | html2text

rm .login.html; rm .cookies.txt; rm out.txt; rm out2.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

End of file unexpected error

Hi, I am new to unix. I have written a script whenever i am giving sh filename.sh its prompting unexpected end of file in line number 40 in that line i have echo statement what do i need to do thanks in advance (5 Replies)
Discussion started by: hamsa
5 Replies

2. Shell Programming and Scripting

syntax error: unexpected end of file

Hi, I need ur help is this matter, i have th ebelow script, and i keep getting this error: syntax error: unexpected end of file affectedRow=`cat dbOutput.log | grep "1 row affected"` echo "affectedRow : $affectedRow" if ; then echo "Look to the next OMCDB" ... (10 Replies)
Discussion started by: Alaeddin
10 Replies

3. Shell Programming and Scripting

unexpected end of file error

hi, i am trying to connect to sqlplus in an 'if block' from the script. it is giving unexpected end of file error. and it works fine if it is out of 'if block'. if anybody have idea on this, can you please help me to solve the error ? piece of code is given below. if then... (11 Replies)
Discussion started by: vinayakatj56
11 Replies

4. Shell Programming and Scripting

unexpected end of file error

When I run the following script: #! /bin/bash for var in CA CC CD CT EC PC do cat << EOF > ${var}_full.dat echo T ${var}_high echo C age echo C sex echo C ht echo C WT_lg EOF cat << EOF > ${var}_agesex.dat ... (4 Replies)
Discussion started by: polly_falconer
4 Replies

5. Shell Programming and Scripting

syntax error: unexpected end of file

Hi, I am newbie to UNIX scripting. I am facing this error "syntax error: unexpected end of file" while executing the following script: ------ a=$1 if then sqlplus -s prospect_stg/prospect_stg@mdmpt <<END insert into bckup_marc_parameter_lookup select * from... (6 Replies)
Discussion started by: boopathyvasagam
6 Replies

6. Shell Programming and Scripting

error unexpected end of file

Sometimes while unziping some files i got an error and the further unziping stopped.might be other files are able to be unzip.i.e gunzip a.Z b.Z c.Z gunzip: a.Z: unexpected end of file it found an error on a.Z and stopped but b.Z and C.Z might be correct. why this error comes and is... (2 Replies)
Discussion started by: malikshahid85
2 Replies

7. Shell Programming and Scripting

`end of file' unexpected error

When I am executing my really simple shell script below, I got an error: `end of file' unexpected. Script is suppose to print out a list of supplied parameters. Here is my script: #!/bin/sh a=$# #number or parameters b=0 #starting counter while do b=`expr $b + 1` echo... (9 Replies)
Discussion started by: alexstar
9 Replies

8. Shell Programming and Scripting

Unexpected end of file error

Hi , I am new to Unix and this is my first shell script . I am facing "unexpected end of file error" while executing my code . tried removing blank spaces Unable to trace out the error . PLease help !!! #!/bin/sh echo hello if ] echo hi then var=`cat liq_table_nm.txt` ... (6 Replies)
Discussion started by: sen180185
6 Replies

9. Shell Programming and Scripting

syntax error unexpected end of file

I am new to unix, so thank u for ur patience I try to make it work (to duplicate two first columns in several files): #!/bin/bash for i in `seq 2 5` do awk `{ print $1,$1,$2,$2,$3,$4}` final_chr.${i} > input_${i} done and i get ./my_script3.sh: command substitution: line 5: syntax... (2 Replies)
Discussion started by: kush
2 Replies

10. Shell Programming and Scripting

Unexpected End of File Syntax Error

Hi, I am brand new to this so I apologize ahead of time for any formatting problems. I know there is a previous (closed) thread on here about this problem but I wasn't able to fix the error following the posts there so I thought I could create a new one. Here is the error I am getting: ... (3 Replies)
Discussion started by: SierraG
3 Replies
KCOOKIEJAR4(8)							 KDE User's Manual						    KCOOKIEJAR4(8)

NAME
kcookiejar4 - KDE HTTP cookie daemon SYNOPSIS
kcookiejar4 [--help] [Generic-options] [Qt-options] [KDE-options] [--shutdown] [--remove domain] [--remove-all] [--reload-config] DESCRIPTION
kcookiejar4 handles the HTTP cookies providing a D-BUS service to store/retrieve/clean cookies. GENERIC OPTIONS
--author Show author information. --help Show help about options. --help-all Show all options. --help-kde Show KDE specific options. --help-qt Show Qt specific options. --license Show license information. -v--version Show version information APPLICATION OPTIONS
--shutdown Shut down cookie jar and the D-BUS service. --remove domain Removes cookies for domain from the cookie jar. --remove-all Removes all the cookies from the cookie jar. --reaload-config Reloads the configuration file. USAGE
KDE web browser konqueror uses kcookiejar4 for storing and managing cookies using the D-Bus service kcookiejar4 provides. When kcookiejar4 is started without parameters, it provides a D-BUS service to handle HTTP cookies. When kcookiejar4 is started with some parameters, it does adittional tasks to the cookies jar it provides, like removing the cookies from one domain. SEE ALSO
kdeoptions(7), qtoptions(7) BUGS
There are probably tons of bugs. Use bugs.kde.org: http://bugs.kde.org to report them. AUTHORS
Waldo Bastian <bastian@kde.org>, Dawit Alemayehu <adawit@kde.org>. 2008-10-14 KCOOKIEJAR4(8)
All times are GMT -4. The time now is 07:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy