Traditionally people use sed, not vi from scripts. And I'm not s sed user. :< Fortunately, I don't think you need it anyway. Without testing it at all, I think you need something along the lines of: === #!/bin/sh while read $LINE ; do UID=`echo $LINE | cut -d: -f 1` NAME=`echo $LINE | cut -d: -f 2` if [ $UID != UID ]; then useradd $UID $NAME # I don't know the right arguments offhand. fi done < passwordfile === If you save the to a file xyz, thing test it by running "sh -x xyz", you will get debug output. Hope that gives you enough to get started. Greg
hi:
Can someone who knows shell scripting help me with this:
I want to write a simple script that will add logins to my password file using these commands:
o vi o while o read o echo o useradd ??etc?..
This input file called "passwordfile" has these users to be added to my password file:
<Snip>
UID:Name jms:John Smith poi:Peter Inkspot lkj:Linda Jones hgf:Harry Fargo nbv:Nancy Vaughn sdf:Sam Fettucini lkj:Larry Johnson
<Snip>
thanks
__________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
Greg Freemyer Internet Engineer Deployment and Integration Specialist Compaq ASE - Tru64 v4, v5 Compaq Master ASE - SAN Architect The Norcross Group www.NorcrossGroup.com
participants (1)
-
Greg Freemyer