![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help in passing array of inputs to C program using script? | ahjiefreak | Shell Programming and Scripting | 1 | 03-20-2008 07:36 AM |
| sed to replace only one istance in a file at a time | ramaramarama | UNIX for Dummies Questions & Answers | 1 | 10-19-2007 01:07 PM |
| replace time format | happyv | Shell Programming and Scripting | 16 | 04-25-2007 03:39 AM |
| Shell script with arguments | sankar6254 | Shell Programming and Scripting | 3 | 12-22-2003 09:21 AM |
| Passing arguments to a script | Kevin Pryke | Shell Programming and Scripting | 3 | 06-14-2002 10:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help how replace stardard keyboard inputs by arguments at run time of a script
Hello Everybody,
Please help. I was trying to automate the use of a third-party given shell script. The script is written to be used at run-time to collect a few variables to be provided by the user through key board, in the fashion as below: ./runcommand please provide a file name to dump the output: then user type in the file name please provide the user name: then user type in the user name please provide password then user type in the password please provide role: then the uese type in the answer to the role I want to run this command automatically without the user interactive input as I know in advance my answers to those questions. Ideally like: ./runcommand file_name user_name user_password user_role or something similar that the command does not wait for the user's interaction. How can I do that? Thanks in advance --Dingrong |
|
||||
|
If you don't want to modify the script itself you could use expect. Here is a link:
Expect - Expect - Home Page Also if you do a search on expect in these forums you should find examples. |
|
||||
|
It sucks to have to use a separate file for that. If you are writing a script, keeping the information in the same script as a here document is probably preferrable. Code:
runcommand <<answers_r_us /path/to/dump/output username p455w0rd Sarah Bernhard role answers_r_us Obviously, replace the placeholders with the actual input you need. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|