HOW TO CREATE 10 USERS IN UNIX(HP-UX) USING SHELL
SHELL SCRIPT?
Answers were Sorted based on User's Feedback
Answer / nimal
#!/bin/sh
for i in {1..10)
do
echo "creating user"$i;
useradd user$i;
done
to list the created users.
cat /etc/passwd
| Is This Answer Correct ? | 9 Yes | 2 No |
Answer / pitambar mishra
My dear friends,
you have used 'useradd' command in the script through which we can only add the user name. But for adding password you should use 'passwd' command because password is also mandatory.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / dibala
#!/bin/ksh
set -x #on
#variable
i=1
while [ i let 10 ]
do
/usr/sbin/useradd user$i -d /home/user$i -s /bin/ksh -m
user$i
i=$(expr $i + 1)
done
| Is This Answer Correct ? | 0 Yes | 1 No |
Why is the use of shell script?
How can I set the default rwx permission to all users on every file which is created in the current shell?
What is the difference between a variable and value?
What is awk in shell script?
How do I run a shell script in powershell?
How to make userdefined variables to available for all other shells?
What is scripting used for?
How to get the first line from a file using just the terminal?
What is INODE?
What is shell geeksforgeeks?
What does echo $0 do?
What is the difference between break and continue commands?