09-17-2020, 04:27 PM
#! /bin/bash
if [ $# -lt 1 ]
then
echo "use not properly can use this file"
exit 0
fi
if [ -f $1 ]
then
for user in $(cat "$1")
do
useradd $user
done
else
echo "file not found"
fi
#create a user list
vim /user.txt
user1
user2
user3
user4
user5
#Run the script
sh /user.sh /user.txt
if [ $# -lt 1 ]
then
echo "use not properly can use this file"
exit 0
fi
if [ -f $1 ]
then
for user in $(cat "$1")
do
useradd $user
done
else
echo "file not found"
fi
#create a user list
vim /user.txt
user1
user2
user3
user4
user5
#Run the script
sh /user.sh /user.txt