[Solved] Shell scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] Shell scripting
# 1  
Old 06-07-2013
[Solved] Shell scripting

I am new to write scripts.
I want help to write a shell script to create 10 users and passwords to users.
Can any please help me.

Last edited by Scott; 06-07-2013 at 04:26 AM.. Reason: Changed from all uppercase.
# 2  
Old 06-07-2013
What have you started with???
# 3  
Old 06-07-2013
Each OS will have it's own variation. What are you running on?uname -a


Robin
Liverpool/Blackburn
UK
# 4  
Old 06-07-2013
i am running in linux
# 5  
Old 06-07-2013
.... and the Linux variant? Is it (big breath) SuSe, RHEL (Red Hat), Debian, CentOS, ......
# 6  
Old 06-07-2013
Code:
mkdir -p /home/admin/useraccounts
for (( i=0; i<=500; i++ )) 
do
        #Create users whose name starts with baci, 
        #so this script will create baci1, baci2, baci3 etc depending on i value.   
   useradd baci$i
   < /dev/urandom tr -dc A-Na-n1-9_ |\
   head -c8 > /tmp/passwd.txt
        #this command is bit tricky, < /dev/urandom  
        #will generate all the random characters which are not even present
        #on keyboard.. and tr -dc A-Na-n1-9, will display only characters
        #which are from A to N, a to n and 1 to 9. This is to avoide o(small o),  
        #O(capital o), 0(numerical zero) characters in order to remove 
        #confusion in the password.  #And there is no character limit.   so head -c8
        #will limit the random characters to just 8
 
done   # was missing!!!  (VBE)

i found this example but i dont need the random password, i want my own passwords to users and each user has to take one password from the passwd.txt file

Last edited by vbe; 06-07-2013 at 09:35 AM.. Reason: code tags reorg the code display...
# 7  
Old 06-07-2013
Quote:
i want my own passwords to users and each user has to take one password from the passwd.txt file
What is the point since a user can after type passwd to change it...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Need help understanding ksh scripting.

Can any one please tell me where the error in below script. Output is not as per my requirement. if condition not comparing the result of record count of a file with 1. where is the pbm in my script? Appreciate your help.. #!/bin/ksh #Module- #Summary- To move the file to direcotries if... (9 Replies)
Discussion started by: shivadanam
9 Replies

2. Shell Programming and Scripting

[SOLVED] Book for shell scripting

I plan to buy a shell scripting book. Please suggest me a best book for shell Scripting. It will be great if the book contains more examples. Regards Kalai ---------- Post updated at 01:24 AM ---------- Previous update was at 01:09 AM ---------- I got the solution in the below post. (0 Replies)
Discussion started by: kalpeer
0 Replies

3. Shell Programming and Scripting

[Solved] need help in shell scripting

Hi Friends, Please help me with the following problem: I have a text file with the following lines: Dated: 8/11/2011 <br> Time : 0000 <br> ============== <br> --------------------------------------<br>Data Upload Time =4:51:52... (2 Replies)
Discussion started by: anuajay1988
2 Replies

4. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

5. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

6. Shell Programming and Scripting

(solved) Shell scripting to access SQLPLUS using variable

I have shell script which will try to login to SQL Plus and retrieve some data, based on the outcome i will proceed further Below is the content of the file pebblz02% cat test1.ksh #! /bin/ksh dummyvar=`sqlplus -S csm_admin/csm_admin@SIDNAME <<EOF echo hi; exit; EOF` Error message on... (0 Replies)
Discussion started by: kiranlalka
0 Replies

7. Shell Programming and Scripting

[Solved] help me in this looping in shell scripting

Hi, #!/bin/ksh result='/TIA/app/UniQP/queue/document/CSB' i=0; while ; do i=`expr $i + 1` if ($i -lt 5);then echo "THerrFile_$i.err"; else break; fi done ... (0 Replies)
Discussion started by: sudhir_83k
0 Replies

8. Shell Programming and Scripting

[Solved] Read a line from one string till to another.... Unix scripting..

So i have a file which contains paths to JPG images separated by a space. I have to separate them each path to another file. So, I have to search all strings that start from /home/ and ends with .jpg or .png Then write each one to another file... Can you please help me on doing this???:cool: (11 Replies)
Discussion started by: hakermania
11 Replies

9. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

10. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
Login or Register to Ask a Question