> -----Original Message-----
> From: Mikevl
> Sent: Sunday, December 01, 2002 11:14 AM
> Subject: Shell scripting help
> 
> 
> Hi
> 
> Can anybody help with this simple script
> 
> Command is useradd userfile
> 
> 
> useradd
> userfile=$1
> s=0
> for i in 'cat $userfile ';do
>         $NAME='cut -d : -f1'


Assignments are done without the $. The $ is used to retrieve an assignment
(expansion). Also, if you want your variable to equal the execution of a
command string (like what your doing), then enclose the commands in back
quotes. i.e.

NAME=`cut -d ':' -f1`

FWIW: single quotes inhibit expansion. i.e.

HOME='Steve Cowles'
echo '$HOME'

would echo $HOME, not the value of $HOME. On the other side of the coin,
double quotes would perform expansion prior to echoing the results. ie.

HOME='Steve Cowles'
echo "$HOME"

would echo Steve Cowles

BTW: All of the above can be found in "man bash"

Steve Cowles



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to