Subject: Re: variables in csh
To: None <netbsd-help@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-help
Date: 10/15/2001 00:33:40
In article <01101420271709.00321@gus.starling.ws>,
Gan Uesli Starling <oinkfreebiker@att.net> wrote:
>I'd like to set a variable in a shell script. I can do it on the command line 
>but in a script it fails. 
>
>On the command line...
>
>set foo = `ps | grep ppp-up | cut -d ' ' -f1 | tr '\n' ' ' `
>
>...so that later I can...
>
>echo $foo
>kill $foo
>
>And in the script...
>
>foo = `ps | grep ppp-up | cut -d ' ' -f1 | tr '\n' ' ' `
>if ( $foo != '' ); then
>  kill $foo
>fi
>
>...so that I can call the script and it will kill one or more results from...

The syntax of the script above is a mix of csh and sh. Just use bourne
shell..

#!/bin/sh
foo=`ps | grep ppp-up | cut -d ' ' -f1 | tr '\n' ' '`
if [ ! -z "$foo" ]; then
    kill $foo
fi