[linux] script question

Tristan Burch tburch at u.washington.edu
Wed Mar 10 10:10:11 PST 2004


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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman13.u.washington.edu/pipermail/linux/attachments/20040310/385b22e9/attachment.html>


More information about the Linux mailing list