terminal script to create home dirs in OS X
I am perhaps the worlds worst scripter, but to erradicate the fear that is creating a working script i have decided to have a crack at something i have been meaning to do for some time.
I have an OS X Server that is connected to a AD for user authentication. Their home dirs are stored on our XRAID. During the User creation process i would like to be able to run a script that creates the User home dir, copies a ready-made user template into the users' home dir and then chowns the folder and its contents for that user.
To start i have looked at getting a list of the users from the AD and also their corresponding UIDs. I have used the following command to get this data:
dscl /Active\ Directory/All\ Domains list /Users UniqueID
This gives a two column output; the first column is the usernames and the second column is the UID.
Now my question how can i just extract the second column to use its' data. At first i though grep or perhaps an awk command? But how would i tell it to start at the second column?
Hope you guys can help.