Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing an input file to userdel -r 1

Status
Not open for further replies.

SteveR77

Programmer
Sep 18, 2000
813
US
Currently I have the following script and I am merely looking for validation before I execute it in my environment -

#!/usr/bin/ksh

while echo "Enter user to delete or CTRL-d to quit: \c"
read username
do
echo $username >> userlist.txt
done


echo
userdel -r < userlist.txt

What I wish to be sure of is that that userlist.txt file will be parsed by userdel and every entry in the file would cause a valid user account to be deleted.

Thank you for your assistance.
 
Why not simply this ?
while echo "Enter user to delete or CTRL-d to quit: \c"
read username
do
userdel $username
done

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,

Thank you for your reply. I know that IO has a lot of overhead and the method you suggest is much cleaner.

I will have to find out if the powers that be here need an audit trail and if so I will do the appending of the data to a file so the log can be built.

Thanks you once again.


SteveR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top