LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-15-2005, 08:30 AM   #1
Aziz
LQ Newbie
 
Registered: Sep 2004
Location: USA
Distribution: Fedora Core 3
Posts: 29

Rep: Reputation: 15
Red face [ksh] How to respond to questions


hello guys,

I have a program which you invoke like:

qtpasswd username

then it asks for password, and then to confirm password..

I wanted to create a korn shell script which I will send the username AND password and it excutes that script (All i want is one line, so i can excute it via php shell_exec)..

thanks for any ideas,

currently I have:

PHP Code:
if [[ $# < 2 ]]
then
        
print "Username and/or password not given"
        
print "===========EXITING================"
        
exit
fi

qtpasswd 
$1
$2
$
but then it waits for the password, and then excutes the password..

anyway to tell it to take the $2 as the pasword and confirmation..

Thanks again,

Last edited by Aziz; 11-15-2005 at 08:34 AM.
 
Old 11-16-2005, 01:23 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Try "expect".
 
Old 11-17-2005, 04:30 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
I usually do this:

Code:
echo  "$1\n$2" | qtpasswd
if it's not clever enough to use /dev/tty it should work
bash needs echo -e ksh doesn't

Last edited by bigearsbilly; 11-17-2005 at 04:32 AM.
 
  


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
where is my /bin/ksh ']['HeBroken Linux - Software 2 03-11-2006 04:25 PM
Three ksh scripting questions liguorir Linux - Software 2 10-22-2005 12:40 PM
The ksh command Gins Linux - General 10 11-20-2004 06:56 PM
some ksh scripting nabil Programming 1 03-03-2002 10:34 PM
How to configure ksh? OneMrGchaser Linux - General 2 11-10-2001 12:30 PM

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

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

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