Last active
March 6, 2018 11:38
-
-
Save Zenexer/5820858 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Author
Zenexer
commented
Jun 20, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment