This is a discussion on Passing value from variable while its expected from keyboard within the Shell scripting forums, part of the Development/Scripting category; I have written a small script to execute a program which is written in c++. Now the program expects input ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
I have written a small script to execute a program which is written in c++. Now the program expects input from keyboard while i need to pass that from the variable. How can I do that? Pardon me..i am a beginner.
|
| Sponsored Links | ||
|
|
|
|||
|
Thanks nix
i am calling a program called "cdrtool" . I cant modify this program. when I normally execute from command line $ cdrtool m12 p The 'p' is to get the input from keyboard. But i wanted to pass this value from a file. It takes the input and gives me an input. so tried like this (which was not working) #!/bin/sh ls -1 *.asc > file1 cat file1 | \ while read line do cdrtool m12 p | $line done rm file1 exit now i have changed this to as below and it works #!/bin/sh ls -1 *.asc > file1 cat file1 | \ while read line do echo $line | cdrtool m12 p done rm file1 exit Anyway thanks a lot for ur reply..i will aslo try ur method and learn how it works. Since i will be learning more in coming days, I may have questions for which i would need ur help. Thanks. |
|
||||
|
There are many ways to solve one problem. I’m glad that you sorted it out with pipes
Quote:
|
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SSH - Passing Unix login passwords through shell scripts | arulkumarr | Shell scripting | 4 | 08-27-2008 10:22 PM |
| passing options to a shell script | bigpaw | Shell scripting | 2 | 10-11-2007 03:40 AM |
| How do I turn off the power button on sun keyboard? | monk | Solaris/OpenSolaris | 0 | 01-30-2007 03:12 AM |
| Linux usb keyboard does not work | jerry | Linux software | 3 | 04-05-2006 10:21 PM |
| HTML variable | nathan86 | Linux software | 3 | 03-23-2005 01:29 PM |