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

RE: Shell scripting help



Thanks

This program will extract names from an input and put them into another
command.

userfile=$1
s=0
for i in 'cat $userfile ';do
#       s=$s+1
        NAME='cut -d : -f1'
        echo $NAME
#       echo $s
done

The output is as below instead of a list of names as I would like

[root Lizzi root]# ./addscusers scusers
cut -d : -f1
[root Lizzi root]#

Many thanks
Mike

-----Original Message-----
From: redhat-list-admin redhat com
[mailto:redhat-list-admin redhat com]On Behalf Of Adam H. Pendleton
Sent: Monday, 2 December 2002 07:56
To: redhat-list redhat com
Subject: RE: Shell scripting help


*This message was transferred with a trial version of CommuniGate(tm) Pro*
Change the line:

$NAME='cut -d : -f1'

to be:

NAME='cut -d : -f1'

$NAME as a left-hand operator causes expansion, which in this case probably
expands to "", leaving you with:

='cut -d : -f1'

which is the text of your error message.

ahp

> -----Original Message-----
> From: Mikevl [mailto:Mikevl paradise net nz]
> Sent: Sunday, December 01, 2002 13:52
> To: Redhat-List (E-mail)
> Subject: Shell scripting help
> 
> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> Thanks Robert
> 
> No I didn't name the file useradd it has quite a different name
> The cut command works from the command line but from the script I get
> 
> [root Lizzi root]# ./addscusers scusers
> ./addscusers: =/bin/cut -d : -f1: No such file or directory
> 
> Many thanks
> 
> Mike
> 
> -----Original Message-----
> From: redhat-list-admin redhat com
> [mailto:redhat-list-admin redhat com]On Behalf Of Robert P. J. Day
> Sent: Monday, 2 December 2002 07:08
> To: redhat-list redhat com
> Subject: Re: Shell scripting help
> 
> 
> On Sun, 1 Dec 2002, Bill Horne wrote:
> 
> > ----- Original Message -----
> > From: "Mikevl" <Mikevl paradise net nz>
> >
> >
> > > 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'
> > >         echo $NAME
> > > done
> >
> > info cut.
> 
> *please* tell me you didn't actually name the executable
> script file "useradd".
> 
> rday
> 
> 
> 
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request redhat com?subject=unsubscribe
> https://listman.redhat.com/mailman/listinfo/redhat-list
> 
> 
> 
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request redhat com?subject=unsubscribe
> https://listman.redhat.com/mailman/listinfo/redhat-list





-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request redhat com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list





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