[linux] script question

rtlibby at u.washington.edu rtlibby at u.washington.edu
Wed Mar 10 10:23:00 PST 2004


Well I'm sure you'll get a lot of answers froim people who are actuallly
competent with bash scripting, but I think all you need to do is put ` `
around the command, i.e. `adduser -u $ID $USER` Note that those aren't
apostrophes.

~ryan

On Wed, 10 Mar 2004 10:10:11 -0800, Tristan Burch
<tburch at u.washington.edu> wrote:


> I'm trying to write a script that will read the username and userid from

> a

> text file and then add that user to the machine with the specified id.

> I'm

> kinda new to scripting, so I'm not sure exactly what I'm doing wrong.

> Here's

> what I have:

>

> #!/bin/bash

>

>

>

> NEW_USERS="test.txt"

>

>

>

> cat ${NEW_USERS} | \

>

> while read USER ID

>

> do

>

> adduser -u $ID $USER

>

> echo Added User:$USER - ID:$ID

>

> done

>

>

>

> when I run it, I get this:

>

> 'dduser: invalid numeric argument `551

>

> Added User:tburch - ID:551

>

>

>

> I'm not sure why it's chopping off the "a" in adduser, but I think it has

> something to do with how the variables get evaluated (?). Any

> suggestions?

>

>

>

> Thanks,

>

>

>

> Tristan Burch

> <mailto:tburch at u.washington.edu> tburch at u.washington.edu

>

>

>




--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


More information about the Linux mailing list