Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Linux in General => Linux Development & Programming => Topic started by: purusrhce on October 01, 2006, 04:32:34 AM

Title: user administration(2)
Post by: purusrhce on October 01, 2006, 04:32:34 AM
hi all,

      i am having an issue while creating user account. i wrote a script for creating a user account in the name of 132001 to 132050.
     when i run the script i am getting an error message showing invalid user account.But if i run the script to create a name (ex) ram, tony ..... i can create an user account. i am using redhat linux 9.
     can anyone pls tell me how to solve this problem.


Thanks in Advance,
Purushothaman.
Title: user administration(2)
Post by: gauravbajaj on October 04, 2006, 04:51:26 AM
Ok

Just , send or Paste your scripting code here....,otherwise its difficult that where u r getting error...

Gaurav
Title: user administration(2)
Post by: purusrhce on October 04, 2006, 06:06:11 AM
Quote from: "gauravbajaj"
Ok

Just , send or Paste your scripting code here....,otherwise its difficult that where u r getting error...

Gaurav


hi gaurav,

Here the script

for I in $ (seq 113001 113050)
do
useradd $I
echo password | passwd --stdin $I
chage -d 0 $I

             when i run this script i am getting invalid user name,but if i am doing like this i can create

for I in $@
do
useradd $I
echo password | passwd --stdin $I
chage -d 0 $I
 
            if i run this script (i.e) bash users ram tony ...........  i can create user accounts
              I want to create a user account in numbers i.e 113001, 113002 ...........  


I am waiting for your Reply.

Thanks in Advance,
Purushothaman.
Title: user administration(2)
Post by: dragoncity99 on November 12, 2006, 03:43:09 AM
Why not u try to debug the script using -x option while running ur shell script?

i.e.:

root@localhost# bash -x /path/to/your-script

i assume ur using bash shell scripting. If it's not sorry, u can ignore what i shared with you here.
Title: Re: user administration(2)
Post by: gauravbajaj on June 14, 2007, 03:52:39 AM
Do one  thing enclose your numbers i.e 113001 with single quotes, so that it behaves like chracter string .........

I haven't tried this as I dont have the Linux/Solaris PC having root privalages, but just give a try
Title: Re: user administration(2)
Post by: Ujjwol on August 11, 2007, 07:58:47 AM
Do one  thing enclose your numbers i.e 113001 with single quotes, so that it behaves like chracter string .........

I haven't tried this as I dont have the Linux/Solaris PC having root privalages, but just give a try
what this all scripting about i wanna learn and join
Title: Re: user administration(2)
Post by: gauravbajaj on September 18, 2007, 10:27:34 AM
We were talking about shell scripting , search google to know more.

Thanks
Gaurav