Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
bash-send input to read in another process
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
spielc
Guru
Guru


Joined: 20 Apr 2004
Posts: 452

PostPosted: Tue Mar 02, 2010 4:00 pm    Post subject: bash-send input to read in another process Reply with quote

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
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Tue Mar 02, 2010 7:29 pm    Post subject: Reply with quote

works for me
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
spielc
Guru
Guru


Joined: 20 Apr 2004
Posts: 452

PostPosted: Tue Mar 02, 2010 7:51 pm    Post subject: Reply with quote

Naib wrote:
works for me


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
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Tue Mar 02, 2010 9:09 pm    Post subject: Reply with quote

bash4

What I had todo was: the_script &
then do the echo
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum