[linux] script question

Joshua Daniel Franklin joshuadf at u.washington.edu
Wed Mar 10 10:41:22 PST 2004


Your script works fine for me, with the test.txt file
-----
tburch 551
-----

On Wed, 10 Mar 2004, Tristan Burch 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

>

>

>

>



More information about the Linux mailing list