Variable syntax problem for SunOS 5.8 using C Shell

  • Follow


I'm getting the error "Variable syntax" after running the script
test.csh with the following contents:

#!/bin/csh -f
set PSDE_ARG=$argv

echo $PSDE_ARG | grep -i "sdk" > /dev/null
echo $?


The above is supposed to look for keyword sdk in the input of the
script, for example

"test.csh hellosdk"

should echo 0 if keyword sdk is found. I was able to run the exact same
script successfully on the C shell of SuSE Linux 9.3 and Red Hat
Enterprise Linux WS release 4. I am aware that C shell is not a very
good shell and I know of the top 10 reasons not to use it but it still
has to be supported. Any ideas?

Thierry

0
Reply lamthierry (65) 10/6/2006 2:17:19 PM

Thierry Lam wrote:
> I'm getting the error "Variable syntax" after running the script
> test.csh with the following contents:
> 
> #!/bin/csh -f
> set PSDE_ARG=$argv
> 
> echo $PSDE_ARG | grep -i "sdk" > /dev/null
> echo $?

The "command exit status" in csh is returned in the variable "status", so

     echo $status

instead of the Bourne-ish "$?"

hth
t

0
Reply Tony 10/6/2006 2:22:24 PM


Tony Curtis wrote:
> Thierry Lam wrote:
>> I'm getting the error "Variable syntax" after running the script
>> test.csh with the following contents:
>>
>> #!/bin/csh -f
>> set PSDE_ARG=$argv
>>
>> echo $PSDE_ARG | grep -i "sdk" > /dev/null
>> echo $?
> 
> The "command exit status" in csh is returned in the variable "status", so
> 
>     echo $status
> 
> instead of the Bourne-ish "$?"

tcsh also implements $?

$?      Equivalent to `$status'.  (+)

if the script worked on other systems (Linux) then their
csh is really tcsh  (the same way their sh is really bash)
0
Reply Oscar 10/6/2006 2:56:03 PM

2 Replies
1202 Views

(page loaded in 2.048 seconds)

Similiar Articles:













7/20/2012 2:14:19 PM


Reply: