![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| for loop not working - syntax error at line 6: `end of file' unexpected | debojyoty | Shell Programming and Scripting | 3 | 04-13-2009 09:31 AM |
| Help on shell script : syntax error at line 62: `end of file' unexpected | schandrakar1 | Shell Programming and Scripting | 7 | 12-12-2008 09:10 AM |
| syntax error: unexpected end of file | Alaeddin | Shell Programming and Scripting | 10 | 10-20-2008 07:09 AM |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 11:16 AM |
| syntax error at line 59: `end of file' unexpected | Remi | SUN Solaris | 4 | 01-16-2007 02:48 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
syntax error: unexpected end of file
I have a script that's failing
./zzmaster.sh: line 2: syntax error: unexpected end of file There are 4 scripts total involved. The first 'znocc0.sh' essentially curls a page then does some sed sequences... Code:
#!/bin/sh #GET SENTINAL INFO curl -b z0cookie.txt -L -k -e http://4phpfreaks.freehostia.com/index.html -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9 .0.4) Gecko/2008102920 Firefox/3.0.4" -L "http://4phpfreaks.freehostia.com/index.html" > shell.html #cut for brevity - I do several manual sed sequences in between #then for the more advanced, I call it seperately.. ./zrmtd0.sh && mv ztmp.Ps23zp2t.2-Fpps3-wmmm0dss3 shell.html ./zrmtd0o.sh && mv ztmp.Ps23zp2t.2-Fpps3-wmmm0dss3 shell.html Code:
#!/bin/sh
IN=0
CT=0
OUTFILE="ztmp.Ps23zp2t.2-Fpps3-wmmm0dss3"
echo > $OUTFILE # Start with fresh file always
cat shell.html |while read LINE
do
# If we are entering a table row the we need to reset the TD counter
TR=`echo $LINE |grep -i '<tr'`
if [ -n "$TR" ]
then
CT=0
else
echo "" > /dev/null
fi
# Check to see if the LINE is non-empty, and has an opening td tag in it.
TD=`echo $LINE |tr -d '\n' |grep -i '<td'`
if [ -n "$TD" ]
then
# We are inside a td tag.
IN=1
fi
# Check to see if the LINE is non-empty and has a closing td tag in it.
ENDTD=`echo $LINE |tr -d '\n' |grep -i '/td>'`
if [ -n "$ENDTD" ]
then
# We are leaving a td tag.
IN=0
# Increase the TD counter by 1
CT=`echo "$CT+1" |bc`
fi
if [ "$IN" -eq 1 -a "$CT" -eq 6 -a -z "$ENDTD" ]
then
# Use sed to remove this TD tag AND everything in between
echo $LINE |tr -d '\n' |sed 's/.*//' >> $OUTFILE
elif [ "$IN" -eq 0 -a "$CT" -eq 7 ]
then
# We may (or may not) have an opening and closing td tag in 1 line.
TMP=`echo $LINE |tr -d '\n' |sed 's/<TD.*//'`
echo $TMP |sed 's/.*\/TD>//' >> $OUTFILE
else
echo $LINE >> $OUTFILE
fi
done
Code:
sh /home/jim/www/htdocs/curl/replicate/znocc0.sh && Code:
[jim ~/www/htdocs/curl/replicate]$ ./zzmaster.sh ./zzmaster.sh: line 2: syntax error: unexpected end of file [jim ~/www/htdocs/curl/replicate]$ sh /home/jim/www/htdocs/curl/replicate/znocc0.sh && sh /home/jim/www/htdocs/curl/replicate/znocc1.sh && sleep 20 sh /home/jim/www/htdocs/curl/replicate/znocc0.sh && sh /home/jim/www/htdocs/curl/replicate/znocc1.sh && sleep 20 sh /home/jim/www/htdocs/curl/replicate/znocc0.sh && sh /home/jim/www/htdocs/curl/replicate/znocc1.sh && At first I started the script with #!/bin/sh. It complained so I took it out. So now it just complains of the last line. Now aside from the current error, since the script -technically, when I go to configure the cron it breaks... Here's the complaint cron gives me.. Code:
mydomain.net : Dec 24 23:42:06 : jim : /usr/local/etc/sudoers is not a regular file ; TTY=ttyp1 ; PWD=/home/jim/www/htdocs/curl/replicate ; USER=root ; COMMAND=root Code:
## replicate * * * * * root /home/jim/www/htdocs/curl/replicate/zzmaster.sh Code:
jim# /home/jim/www/htdocs/curl/replicate/zzmaster.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1154 100 1154 0 0 6929 0 --:--:-- --:--:-- --:--:-- 0
him#
|
![]() |
| Bookmarks |
| Tags |
| awk, awk trim, trim, trim awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|