Reputation: 23
I am trying to write my own shell script to add a user in Linux. I don´t want to use useradd. So how to I find the last entry in passwd ? I would like to check the USER ID, and GROUP ID. So i can make +1 to UISER ID and +1 Group ID.
Or is there any possibility to make a grep on the last entry in a file?
e.G.
simpson:x:103:103:Lisa Simpson, etc...
Upvotes: 0
Views: 946
Reputation: 199
With sed:
sed -n '$'p /etc/passwd
http://www.gnu.org/software/sed/manual/sed.html#tail
Upvotes: 0