Re: Shell Script Problem
From: Paul E. Lehmann (plehmann_at_fred.net)
Date: 04/05/04
- Next message: Alejandro Montiel: "Problem updating SuSE 9 to KDE 3.2 and kernel 2.6.4"
- Previous message: Paul E. Lehmann: "Re: Shell Script Problem"
- In reply to: Paul E. Lehmann: "Re: Shell Script Problem"
- Next in thread: Chris Cox: "Re: Shell Script Problem"
- Reply: Chris Cox: "Re: Shell Script Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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"
>>> error=$?
>>> if [ $error != 0 ]
>>> then
>>> echo "Can't find it in the vineyards"
>>> fi
>>>
>>> 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.
>>
>> Michael
>
> thanks for trying it.
> Any ideas why it doesn't work for me on my machine - anyone ?
STRANGE;
I just created a new file with a new file name and recopied and now it
works.
Oh, the mysteries of Linux.
- Next message: Alejandro Montiel: "Problem updating SuSE 9 to KDE 3.2 and kernel 2.6.4"
- Previous message: Paul E. Lehmann: "Re: Shell Script Problem"
- In reply to: Paul E. Lehmann: "Re: Shell Script Problem"
- Next in thread: Chris Cox: "Re: Shell Script Problem"
- Reply: Chris Cox: "Re: Shell Script Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|