Tp Shell Suite
This commit is contained in:
@@ -13,12 +13,18 @@ if [[ ! -r "$1" ]] ; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
|
||||
fich=$1
|
||||
while read ligne
|
||||
do
|
||||
login=$(echo "${ligne}"|cut -d: -f1)
|
||||
nom=$(echo "${ligne}"|cut -d: -f2)
|
||||
echo "${login} ${nom}"
|
||||
#echo "${login} ${nom}"
|
||||
getent passwd "${login}" >> /dev/null
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
sudo useradd --create-home --home-dir /home/"${login}" --shell /bin/bash --comment "${nom}" "${login}"
|
||||
else
|
||||
echo "$0 : utilisateur ${login} existe deja"
|
||||
fi
|
||||
|
||||
done < $fich
|
||||
|
||||
|
||||
Reference in New Issue
Block a user