Tp Shell Suite

This commit is contained in:
2022-03-25 09:34:36 +01:00
parent 66ba6ac484
commit b7be885670
4 changed files with 77 additions and 3 deletions

View File

@@ -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