HOW TO CREATE 10 USERS IN UNIX(HP-UX) USING SHELL
SHELL SCRIPT?

Answers were Sorted based on User's Feedback



HOW TO CREATE 10 USERS IN UNIX(HP-UX) USING SHELL SHELL SCRIPT?..

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

HOW TO CREATE 10 USERS IN UNIX(HP-UX) USING SHELL SHELL SCRIPT?..

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

HOW TO CREATE 10 USERS IN UNIX(HP-UX) USING SHELL SHELL SCRIPT?..

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

Post New Answer

More Shell Script Interview Questions

How can we find the process name from its process id?

0 Answers  


What is difference between shell and bash scripting?

0 Answers  


How can you get the value of pi till a 100 decimal places?

0 Answers  


How do you schedule a command to run at 4:00 every morning?

5 Answers   Wipro,


What does path stand for?

0 Answers  






How are shells born?

0 Answers  


What is shell chemistry?

0 Answers  


What are the advantages of shell script?

0 Answers  


Determine the output of the following command: [ -z “” ] && echo 0 || echo 1

0 Answers  


What will happen to my current process when I execute a command using exec?

0 Answers  


What are the advantages of bash over all other shells?

1 Answers  


What are the different types of variables used in shell script?

0 Answers  


Categories