ngb
05-29-2003, 03:51 AM
i am trying to write a password file in shell programming under linux , now my situation is i would like to get the last record 's UID and increase the value by one, and assign it to a new user account. but i fail to select the last record.....it always come out with error when i run the program........the error is " the command not found"
i already create one record in passwd file .......
becca:12hjhh:1:1:becca thomas:/usr/becca:/usr/ucb/csh
suppose when i create another new user, the user id should be 2, but it come out with error : cannot found the command....
here is what i do :
tempnewID= `tail -1 /etc/passwd | awk -F: '{print $3}' `
newID= ` expr $tempnewID + 1 `
can anyone come out with more suitable command to get the result???thanks
i already create one record in passwd file .......
becca:12hjhh:1:1:becca thomas:/usr/becca:/usr/ucb/csh
suppose when i create another new user, the user id should be 2, but it come out with error : cannot found the command....
here is what i do :
tempnewID= `tail -1 /etc/passwd | awk -F: '{print $3}' `
newID= ` expr $tempnewID + 1 `
can anyone come out with more suitable command to get the result???thanks