uid script help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting uid script help
Prev   Next
# 1  
Old 07-08-2010
uid script help

i need a script to process a password file and based on the UIDs in the password file, generate the new UID that is 1 greater than the highest uid.
i have some script logic but i dont really understand it. any help?
Code:
    #!/usr/bin/perl
   
  ##########################################
    # ITEC 400
  # Script name: newuid.pl
  # Case Number 1: ./newuid.pl small_passwd
  # The small_passwd file is located ~/public_html/itec400/Misc
  # The name of the file must be specified on the command line.
  # Functionality: The newuid.pl script reads the uids in the small_passwd
  # file. The script determines the highest numbers uid currently
  # in use, and adds one to it for the next user.
  ##############################################
   
  for $XXXX(@ARGV) {
  $counter++;
  }
   
  if ($XXXXXXX != 1) {
  print "Error. Need one argument.\n";
  }
   
  if ($XXXXXXX == 1) {
   
  $flag = 0;
   
  exec `XXX -f3 -d":" /export/home/dandrear/public_html/itec400/Misc/$XXXX[]> "uidoutput"`;
   
  open (reader, "uidoutput");
   
  while ($line = <XXXXXX>) {
   
  $firsttest = $XXXX;
   
  if ($XXXX == 0) {
  $secondtest = $XXXXXXXXX;
  } # end if
   
  $flag = 1;
   
  if ($secondtest < $XXXXXXXXX) {
   
  $secondtest = $XXXXXXXXX;
   
  } #end if
   
   
  } # end while
   
  $newIDNum = $XXXXXXXXXX + 1;
   
  print "The new User ID number is ";
  print $XXXXXXXX;
  print "\n";
   
  } # end if

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends, Need someone's help in helping me with the below requirement for a script: > For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details < I know, this is possible through expect programming in a simple... (14 Replies)
Discussion started by: thisissouvik
14 Replies

2. AIX

How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends, Need someone's help in helping me with the below requirement for a script: > For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details < I know, this is possible through expect programming in a simple... (2 Replies)
Discussion started by: thisissouvik
2 Replies

3. Shell Programming and Scripting

Script to pull uid greater than 1000 from remote server

Hello, I am trying to get UID # greater than 1000 from all linux server, I tried this script getting this error message, someone please suggest. $for i in `cat hostlist.0709.org` ; do ssh -t $i 'awk -F':' "{ if($3 >= 1000) print $0 }" /etc/passwd ' >> output ; done $ cat output hostname1... (4 Replies)
Discussion started by: bobby320
4 Replies

4. Shell Programming and Scripting

Create user if UID not exist; else, exit the script

Hi, I want to write a script to check whether an user ID is used in my server and then create that user. If the user ID is not used, I will echo something like "OK, continue" and then continue to execute the script. Else, I will echo something like "Used, exit" and then exit the script. As... (4 Replies)
Discussion started by: dirkaulo
4 Replies

5. Solaris

UID Admin

Hi All, I have to give permission to one of the groups called as "ABC" as like the permissions of the group "UNIXADM". Could you please some one help on this issue ? (3 Replies)
Discussion started by: ramareddi16
3 Replies

6. AIX

More than 1 UID 0

Hi, Can any one please tell what are the risks of having more than one users having UID 0 (root)? Thanks Naveed (9 Replies)
Discussion started by: naveedaix
9 Replies

7. Shell Programming and Scripting

UId

is tty command opens a process in the system if yes then why process got the userid????? (5 Replies)
Discussion started by: Mac91
5 Replies

8. Shell Programming and Scripting

awk script doubt in extracting and comparing uid

Hi, I need to get the value of 'uid' from a line in file f1. For example, in the line below, I need to get the value '150', from the 'anonuid=150' key, and I need to verify that this is a valid uid by checking it against /etc/passwd (i.e) I want to compare this uid, 150 (or more if there are any... (2 Replies)
Discussion started by: royalibrahim
2 Replies

9. Shell Programming and Scripting

checking uid

How do i go about getting the uid of the user and verify ? if then echo "You are not a superuser, please login as a superuser" exit1; fi the above code doesn't work. can some guru please help me. 1. how to get the uid of the user ? i know by typing id but how to... (7 Replies)
Discussion started by: filthymonk
7 Replies

10. UNIX for Dummies Questions & Answers

set uid question w/ backup script

this is the backup script. When i run it as a non root or authority user i get the following errors for each filesystem being backedup. It then continues to the next fs. Do i have this set up correctly? am i missing something? backup: The backup command has ended abnormally. backup: 0511-225... (2 Replies)
Discussion started by: Optimus_P
2 Replies
Login or Register to Ask a Question