[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
RE: Shell scripting help
- From: "Cowles, Steve" <Steve SteveCowles com>
- To: "'redhat-list redhat com'" <redhat-list redhat com>
- Subject: RE: Shell scripting help
- Date: Sun Dec 1 14:37:01 2002
> -----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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]