Results 1 to 4 of 4
I am getting an "unexpected end of file" error while executing the script.Code is given below. please help me to solve it out
FILE="$1"
exec 3<&0
exec 0<$FILE
while read ...
- 10-21-2008 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 2
Error in shell script
I am getting an "unexpected end of file" error while executing the script.Code is given below. please help me to solve it out
FILE="$1"
exec 3<&0
exec 0<$FILE
while read line
do
echo $line
if [ $line == "balaji" ]
then
echo hai
fi
done
exec 0<&3
exit 0
- 10-21-2008 #2
Can please, explain bit more about your problem?What are you trying out with the script?
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 10-22-2008 #3Just Joined!
- Join Date
- Oct 2008
- Posts
- 2
Hi Lakshmi,
My requirement is to read the file line by line.So i am sending the file name as argument.If any of the line in the file matches
"#student layout" i have to skip next 3 lines and display the other line.Code is given below.
FILE="$1"
key=" "
i=0
exec 3<&0
exec 0<$FILE
while read line
do
echo $line
if [ $line == "#student layout" ]
then
for i in 1 2 3
do
read line
done
fi
done
exec 0<&3
exit 0
Can you tell me is there any syntax error in my code.
Now i am getting an error -"syntax error near unexpected token 'do in line no12."
I am working on Salaris.
- 10-22-2008 #4Just Joined!
- Join Date
- May 2005
- Posts
- 48
On the 5th line
exec 0<$FILE
exec 0<"$FILE" #try with quotes
look here for reference
hth & gl


Reply With Quote