LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-11-2004, 05:29 AM   #1
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Rep: Reputation: 30
"ow to create and execute script"


This is Zameer Ahmed Syed... I would like write a script to create a new user .... i am a new one to unix and Linux... OSs .... if some body have script to create user then After Creating a script how to execute the script file ..... please send me in mail i would really appreciate if some body helps me regding this issue....

Optionally one morething i would like to know

"what are the other interactive capabilities included in 'C' when compare with 'Bourne Shell'"


Thanq very much....
Zameer Ahmed Syed,
Hyd-India.
 
Old 10-11-2004, 06:00 AM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
I would like write a script to create a new user
No need to...you most likely already have a script to do this called "useradd". For details on usage run "man useradd"

Quote:
what are the other interactive capabilities included in 'C' when compare with 'Bourne Shell
I'm not too sure what you mean by this, but C and shell scripting are two different beasts. For one, C is a compiled language which requires a specific "write code, compile, and test" cycle, and typically is not spoken of as "interactive" (of course you can write a C program which is interactive with the user...), while shell scripting, whether sh, bash, csh, zsh et al, are interpreted languages meaning you just "write and run" and see the results immediately.
 
Old 10-11-2004, 09:29 AM   #3
ksraju007
LQ Newbie
 
Registered: Oct 2004
Location: Kerala, India
Distribution: Suse 9.1 Personal
Posts: 13

Rep: Reputation: 0
Its very simple as described above also...

Create a file with lines of following format...

usernameassword:uid:gid:comments:homedir:shell

and issue the command...

#newusers filename

That's it. I have tested it here. If you are still getting errors,post contents of the file you created and the terminal output.

Enjoy!

__________________
Have a nice time....

Rajesh.
 
Old 10-11-2004, 11:10 PM   #4
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
Good Morning Rajesh,

Thanq for nice reply....

This is the file which i created .... in vi editor.....
#!/usr/bin/newusers
aaa111:x:510:510:'just for example':/home/aaa111/bin/newusers
bbb111:y:512:512:'just for example':/home/bbb111/bin/newusers

and after that i saved it and run the following command ....

[root@redhat root]# newusers bulkusers

then it gives me error message like
newusers: line 1: invalid line
newusers: line 2: invalid line
newusers: line 3: invalid line
[root@redhat root]#

then i create new file .....
this time instead of newusers i use bash shell as follows...

#!/usr/bin/bash
aaa111:x:510:510:'just for example':/home/aaa111/bin/bash
bbb111:y:512:512:'just for example':/home/bbb111/bin/bash

then I saved it a file named "createallusers".. after that i run that file using bash shell like as

[root@redhat root]# bash createallusers

then it gives me following error message....

createallusers: line 2: aaa111:x:510:510:just for example: /home/ aaa111/ bin/
bash: No such file or directory
createallusers: line 3: bbb111:y:512:512:just for example: /home/ bbb111 /bin/
bash: No such file or directory

[root@redhat root]#

what was the error .... i think it is PATH Error .... I don't know how to set to PATH..

If u know how to set to PATH plz tell me the procedure.....

1. To whom we have to set the PATH ......it is for user or some other bash file
2. Could you know How to link Different shells ... if so plz tell me the procedure.

Thanq ....
with regds,
Zameer Ahmed Syed.
 
Old 10-11-2004, 11:25 PM   #5
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
Good Morning Rajesh,

Thanq for nice reply....

This is the file which i created .... in vi editor.....
#!/usr/bin/newusers
aaa111:x:510:510:'just for example':/home/aaa111/bin/newusers
bbb111:y:512:512:'just for example':/home/bbb111/bin/newusers

and after that i saved it and run the following command ....

[root@redhat root]# newusers bulkusers

then it gives me error message like
newusers: line 1: invalid line
newusers: line 2: invalid line
newusers: line 3: invalid line
[root@redhat root]#

then i create new file .....
this time instead of newusers i use bash shell as follows...

#!/usr/bin/bash
aaa111:x:510:510:'just for example':/home/aaa111/bin/bash
bbb111:y:512:512:'just for example':/home/bbb111/bin/bash

then I saved it a file named "createallusers".. after that i run that file using bash shell like as

[root@redhat root]# bash createallusers

then it gives me following error message....

createallusers: line 2: aaa111:x:510:510:just for example: /home/ aaa111/ bin/
bash: No such file or directory
createallusers: line 3: bbb111:y:512:512:just for example: /home/ bbb111 /bin/
bash: No such file or directory

[root@redhat root]#

what was the error .... i think it is PATH Error .... I don't know how to set to PATH..

If u know how to set to PATH plz tell me the procedure.....

1. To whom we have to set the PATH ......it is for user or some other bash file
2. Could you know How to link Different shells ... if so plz tell me the procedure.

Thanq ....
with regds,
Zameer Ahmed Syed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
running a script: ". scriptname" vs "./scriptname" to execute beeblequix Linux - Enterprise 3 11-07-2005 04:40 PM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 02:32 PM
remove the "Run or Display?" when I execute a script llee Programming 5 05-05-2003 11:21 AM
remove the "Run or Display?" when I execute a script llee Linux - Software 0 05-02-2003 02:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration