Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Syntax: $_ USER[ USER[ ...]]" >&2
exit 1
fi
exit_code=0
for user in "$@"; do
home="/home/$user"
cp -R /etc/skel "$home" && echo $'\e[32m'"Copied skeleton to: $home"$'\e[m' || ( exit_code=$?; echo $'\e[31m'"Failed to create: $home"$'\e[m' ) >&2
chown -R "$user:$user" "$home" && echo $'\e[32m'"Set owner on: $home"$'\e[m' || ( exit_code=$?; echo $'\e[31m'"Failed to set owner on: $home"$'\e[m' ) >&2
done
exit $exit_code
@Zenexer

This comment has been minimized.

Copy link
Owner Author

commented Jun 20, 2013

# wget
wget https://gist.github.com/Zenexer/5820858/raw/userdir.sh
# curl
curl -o userdir.sh https://gist.github.com/Zenexer/5820858/raw/userdir.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.