On Fri, 2009-02-27 at 11:14 +0000, Tom Brown wrote:
> Hi
> 
> Below if $remaining is empty i want the if to finish - what is it i need 
> to put in SOMETHING?
> 
> if [ "$remaining" = "" ] ; then
>             SOMETHING ;
>         else
>             kill -9 $remaining
> fi

if [ -n "$remaining" ] ; then
   kill -9 $remaining
fi

Man bash, look for builtin "test" and find a bunch of tests defined
there. Keep in mind that "test" and "if [ ... ]" are equivalent in bash.

I don't know how much other code surround this, but I deduce (admittedly
incomplete information) that you have a reducing list operation going?
If so, maybe something like

# Initialize remaing list and then
set "$remaining" # If empty $1 is null
while [ -n "$1" ] ; do
   echo "$1"  # remove this
   kill -9 $
   shift
done

$ remaining="9997 9998 9999"
$ while [ -n "$1" ] ; do
>    echo "$1"
>    shift
> done
9997 9998 9999

> 
> thanks?
> <snip sig stuff>

HTH
-- 
Bill

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Reply via email to