Skip to content
Snippets Groups Projects
Verified Commit 2fb32156 authored by David Beniamine's avatar David Beniamine
Browse files

Make argument optionnal

parent bb87fbd8
No related branches found
No related tags found
No related merge requests found
...@@ -19,20 +19,21 @@ ...@@ -19,20 +19,21 @@
DIR=`dirname $0` DIR=`dirname $0`
usage(){ usage(){
echo "Usage $0 users.txt" echo "Usage $0 [users.txt]"
echo "Reads a list of users and create them" echo "Reads a list of users and create them"
echo "then run $DIR/create_primtux_user.sh on each of them with the apropriate level" echo "then run $DIR/create_primtux_user.sh on each of them with the apropriate level"
} }
if [ -z "$1" ] in="users.txt"
if [ ! -z "$1" ]
then then
usage in="$1"
exit 1
fi fi
echo "Using input file $in"
if [ ! -f "$1" ] if [ ! -f "$in" ]
then then
echo "$1 is not a file" echo "$in is not a file"
usage usage
exit 1 exit 1
fi fi
...@@ -77,7 +78,7 @@ do ...@@ -77,7 +78,7 @@ do
echo $uid >> uids.txt echo $uid >> uids.txt
echo "Done creating $uid" echo "Done creating $uid"
OK="$OK $uid" OK="$OK $uid"
done < $1 done < $in
echo "The following users where correctly created" echo "The following users where correctly created"
echo -e "\t$OK" echo -e "\t$OK"
if [ ! -z $KO ] if [ ! -z $KO ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment