View previous topic :: View next topic |
Author |
Message |
spielc Guru
Joined: 20 Apr 2004 Posts: 452
|
Posted: Tue Mar 02, 2010 4:00 pm Post subject: bash-send input to read in another process |
|
|
Hi!
I have a question for the shell-programming guru's out there. Assume i have the following script:
Code: |
read test; echo $test
|
Now i want another script to send the input to the script above. In my opinion this should work:
Code: |
echo "bla" > /proc/<PID of shell above>/fd/0
|
The result of this is, that bla is written to the stdin of the first command (i see it on the commandline so i know that it's the correct file-descriptor) but the linefeed is somehow not recognized and thus the script never terminates.
Now my question is: Is it possible to do this or do i have to come up with something else? _________________ Raise your beers up high... |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Tue Mar 02, 2010 7:29 pm Post subject: |
|
|
works for me _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
spielc Guru
Joined: 20 Apr 2004 Posts: 452
|
Posted: Tue Mar 02, 2010 7:51 pm Post subject: |
|
|
Really? As is? Hmmm strange
May i ask what version of bash you are using and if you've set some special shopts set? _________________ Raise your beers up high... |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Tue Mar 02, 2010 9:09 pm Post subject: |
|
|
bash4
What I had todo was: the_script &
then do the echo _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
|