[prog] user bash script
Noir
acknak_halflife at yahoo.co.uk
Fri Aug 12 17:23:14 EST 2005
I am writing a bash script to adduser which will first
check if the u_name exist in /etc/passwd file. My
code:
uname="`echo $uname | tr "[A-Z]" "[a-z]"`"
avail="`cat /etc/passwd | grep ^$uname:`"
if [ -e "$avail" ]; then
echo "The name already exist Please try again";
exit 1;
fi
It gives an errror that username already exist but
then goes on to add the user.
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
More information about the Programming
mailing list