Re: Shell Script Problem
From: Paul E. Lehmann (plehmann_at_fred.net)
Date: Sun, 04 Apr 2004 21:59:29 -0400
Paul E. Lehmann wrote:
> Michael Krzepkowski wrote:
>> Paul E. Lehmann wrote:
>>> The following short script will not run correctly under SuSE Linux 9.0
>>> I am able to run it without problem on windoze and under Cygwin.
>>> I must be overlooking something really simple. When I take out the IF
>>> conditional, I don't get the error which says:
>>> /home/plehmann/bin/vine: line 7: syntax error: unexpected end of file
>>> There are only 6 lines in the file and not 7
>>> I have even retyped the script and the results are the same.
>>> The script is:
>>> grep -i "$1" vineyards2002 | grep -i "$2" | grep -i "$3" | grep -i "$4"
>>> | grep -i "$5"
>>> if [ $error != 0 ]
>>> echo "Can't find it in the vineyards"
>>> I haver tried replacing [ $error != 0 ] with [ $error -ne 0 ]
>>> and tried eliminating the square brackets and still get same results
>>> A sample of the file it acts on follows:
>>> l,cb,r01,p12,y98,good to moderate with moderate spurs
>>> l,cf,0lr,p13,y01,new vine - ok
>>> l,cb,r01,p14,y98,moderate with moderate to small spurs
>>> l,cf,r01,p15,y01,new vine - ok
>> Just tried this "as is" (with all grep commands in one line) and it
>> works fine.
>> It gives me "not found..." when I call it with a "strange" parameter
>> (xyz) or correct line with ones that are found.
>> Using 9.0 pro with bash.
> thanks for trying it.
> Any ideas why it doesn't work for me on my machine - anyone ?
I just created a new file with a new file name and recopied and now it
Oh, the mysteries of Linux.