It is currently Fri May 25, 2018 2:46 am

Passing output to another applications input?

All times are UTC - 6 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Thu Nov 12, 2009 4:09 pm   

Joined: Thu Nov 12, 2009 3:55 pm
Posts: 1

I am not sure if that Subject really explains it, basically I have a script that executes a program that requires a passphrase from the user. I can easily execute this by issuing the -p argument followed by the passphrase however that shows up on possible logs or at least on the results of the ' ps ' command. If you do not supply this -p argument it provides a new line with the echo " Enter Passphrase: " and asks for input.

My question is how can I provide a result/input for the Passphrase request and is it still possible to throw this application in the background with the ' & ' following the command?

Example of original:


echo "Attempting connection to Service ";
/usr/local/test/javatestfile -u $username -p $passphrase &


All comments/suggestions appreciated.

 PostPosted: Mon Nov 30, 2009 1:39 am   
User avatar

Joined: Sat Jun 13, 2009 8:53 pm
Posts: 73
Location: Texas!
You're probably going to want to use expect here.

Google around for tutorials on using it, but you can find the expect man page here:

Basically, you can set it up to wait for the " Enter Passphrase: " prompt and then prompt the user for a password. I'm not an expert on using it, otherwise I would try to flesh it out more for you. But, if you try to implement this and run in to trouble, I would be glad to try to answer any more questions about using it.

- thobbs

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 6 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group