LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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
 
LinkBack Search this Thread
Old 11-18-2005, 01:54 PM   #1
dkrysak
LQ Newbie
 
Registered: Sep 2004
Distribution: centos
Posts: 25

Rep: Reputation: 15
BASH - passing paramters to programs


Hi there... say I have the following bash script:


Code:
read -p "Enter a username and press [enter]: " UNAME
echo
read -s -p "Enter a password and press [enter]: " PWORD
echo

useradd -s /sbin/nologin $UNAME
passwd $UNAME
What I want to do is pass the $PWORD the the passwd command when it asks for a password.

Is this possible?
 
Old 11-18-2005, 03:16 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 39,853

Rep: Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121
OK, someone asked this quite recently, and the general outcome was that you are liekly to have the chpasswd program which can do this, or to use expect to automate the manual inreaction passwd requires.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameters to bash script Kamikazee Programming 4 10-01-2005 06:41 AM
setting up scp alias under bash - parameter passing problem gjr Linux - Newbie 4 06-08-2005 06:38 AM
Bash Script Passing variable to Function nutthick Programming 2 02-02-2005 05:15 AM
Passing Parameters to Bash Script mooreted Linux - Software 3 04-05-2004 09:08 PM
Command Shell Paramters merana Linux - General 2 12-28-2002 04:09 PM


All times are GMT -5. The time now is 03:04 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration