Re: Shell Script Problem

From: Paul E. Lehmann (plehmann_at_fred.net)
Date: 04/05/04


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.



Relevant Pages

  • Re: Re:SanDisk Cruzer Mini...
    ... thanks for you time Michael... ... I'll try intalling XP Pro, since it seems that it works just fine in Pro ... > temporarily disabling it and see if that resolves the issue. ... I finally had to format the hard drive, install XP, install the ...
    (microsoft.public.windowsxp.hardware)
  • Re: Re:SanDisk Cruzer Mini...
    ... thanks for you time Michael... ... I'll try intalling XP Pro, since it seems that it works just fine in Pro ... > temporarily disabling it and see if that resolves the issue. ... I finally had to format the hard drive, install XP, install the ...
    (microsoft.public.windowsxp.general)
  • Re: Re:SanDisk Cruzer Mini...
    ... thanks for you time Michael... ... I'll try intalling XP Pro, since it seems that it works just fine in Pro ... > temporarily disabling it and see if that resolves the issue. ... I finally had to format the hard drive, install XP, install the ...
    (microsoft.public.windowsxp.device_driver.dev)
  • Re: Re:SanDisk Cruzer Mini...
    ... thanks for you time Michael... ... I'll try intalling XP Pro, since it seems that it works just fine in Pro ... > temporarily disabling it and see if that resolves the issue. ... I finally had to format the hard drive, install XP, install the ...
    (microsoft.public.windowsxp.basics)
  • Re: Re:SanDisk Cruzer Mini...
    ... thanks for you time Michael... ... I'll try intalling XP Pro, since it seems that it works just fine in Pro ... > temporarily disabling it and see if that resolves the issue. ... I finally had to format the hard drive, install XP, install the ...
    (microsoft.public.windowsxp.help_and_support)