LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to write a script which will take in the password automatically? (https://www.linuxquestions.org/questions/linux-software-2/how-to-write-a-script-which-will-take-in-the-password-automatically-870007/)

thomas2004ch 03-21-2011 11:04 AM

How to write a script which will take in the password automatically?
 
Hi,

I have a script under /etc/init.d/jboss

When I start the Jboss under my user account (assumed test) I type:
Code:

[test ~]#/etc/init.d/jboss start
And it will ask me for paaword:
Code:

Password:
And I have to type the password.

I find this is quite boring. So I want to write a script locally (assumed called myJboss) so when I want to start the Jboss I just type in:
Code:

[test ~]#myJboss start [password]
And this script will not ask me for password anymore.


Regards

Thomas

szboardstretcher 03-21-2011 11:11 AM

http://linux.die.net/man/1/expect

I believe this is relevant to your issue. I've never had to use it though, so I'm unsure of how to give you an example.


All times are GMT -5. The time now is 11:31 PM.