[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: if statement

From: Paul Jarc
Subject: Re: if statement
Date: Wed, 07 Nov 2001 12:04:45 -0500
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7 (i386-redhat-linux-gnu)

This seems to belong on comp.unix.shell.

"Nevin Swan" <address@hidden> wrote:
> for opt in $options ; do
>         if [ $opt = \"DNS\" ] ; then
>                 DNS=TRUE
>         fi
> done
> obviously more to it than that... but $options contains seperate "options"
> put there by an earlier piece of the script, the options are in the following
> format...
> "opt1" "opt2" "opt3" etc...
> this is INCLUDING the ""
> Now, the above "if" statement does work (as in it matches and sets the
> variable DNS to TRUE) but before setting the variable it gives an error of...
> ./testscript: [: too many arguments

Just before the "for" command, add this (make sure to keep the double quotes:
echo options:; echo "$options"; echo end of options.
and post the output of that line.  Something seems to be odd about the
options you have, but if you pretend they're "opt1", "opt2", etc.,
instead of the actual data, no one will be able to help you.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]