LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-14-2006, 11:04 PM   #1
paranoid times
Member
 
Registered: Jan 2005
Distribution: Fedora Core 3, 4
Posts: 135

Rep: Reputation: 16
Bash Scripting


I was trying to get a bash script to run so that I can have a bunch of users made and their passwords changed to a temporary one. Now I can get all the users made, the problem that I am running into is getting it to take a password. I can get it to take output from a file, but I don't want that. I want the script to be independent, I don't know how to get the script to enter the password twice after it runs the command. I hope that is somewhat understandable. If anyone has any ideas that would be great.

cheers,
Michael
 
Old 02-14-2006, 11:34 PM   #2
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
why do u need the script to enter the password twice if it all you are asking for username and password?

Sorry if I havent understood the problem.

Could you please post a sample input and output?
 
Old 02-14-2006, 11:42 PM   #3
paranoid times
Member
 
Registered: Jan 2005
Distribution: Fedora Core 3, 4
Posts: 135

Original Poster
Rep: Reputation: 16
I need it to enter the password twice because the passwd command asks for the password then for the password to be confirmed. I just figured out that using the newline character with an echo works. Thanks though.
 
Old 02-14-2006, 11:58 PM   #4
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
You want the 'expect' command.
Code:
man expect
 
Old 02-15-2006, 10:48 AM   #5
paranoid times
Member
 
Registered: Jan 2005
Distribution: Fedora Core 3, 4
Posts: 135

Original Poster
Rep: Reputation: 16
Hey that is pretty awesome, I never knew that existed. Thanks!
 
  


Reply



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
help bash scripting sh4d0w13 Linux - Newbie 5 08-15-2005 02:02 AM
bash scripting qu drigz Programming 12 06-15-2004 02:09 AM
Bash scripting SWAT Linux - Newbie 2 11-11-2003 03:21 AM
About bash scripting pazvant Programming 3 10-20-2003 11:12 AM
Bash scripting NSKL Linux - General 2 06-08-2002 12:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07: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