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

i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..

0 Answers   Tech Mahindra,


write a shell script to check whether all the directories in the path exist has read and write permission

1 Answers  


Devise a script that takes file name as arguement(which must present in the current directory)and locates from your home directory tree all thpath names of its links.Then mail the list to self.

0 Answers  


What is the syntax of while loop in shell scripting?

0 Answers  


How to rename all the files in a folder having specific extension? Example: I have some files with extension (.txt) in a folder name 'Test'. I have to rename all the .txt files in a test and its subdirectories to .my extension.

15 Answers   Interra IT,


When you login to a c shell, which script would be run first?

2 Answers  


What lives in a shell?

0 Answers  


Why are shell scripts used?

0 Answers  


What are script files?

0 Answers  


What is a shell made of?

0 Answers  


What does egrep mean?

0 Answers  


What are the 3 standard streams in linux?

0 Answers  


Categories