Results 1 to 7 of 7
Hello!
Is it possible to start a process, and then switch its stdin between different inputs?
What I want to do:
cat somefile | someprog
but: I don't want someprog ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-30-2006 #1Just Joined!
- Join Date
- Apr 2006
- Posts
- 10
BASH & pipe reattachment
Hello!
Is it possible to start a process, and then switch its stdin between different inputs?
What I want to do:
cat somefile | someprog
but: I don't want someprog to exit because cat has finished and closed the pipe, instead I want to reattach the stdin to someprog to, for example, the console so that the user may enter further data.
Is that possible with bash? If yes, how?
Thx in advance!
- 04-30-2006 #2
It is possible to split the output of a command in two ways (with tee command) but I'm not sure about a command can get sequentially the pipe data and then the keyboard data.
Best regards
- 04-30-2006 #3Just Joined!
- Join Date
- Apr 2006
- Posts
- 10
Forget about the sequential thing. How about having two inputs concurrently?
- 04-30-2006 #4Just Joined!
- Join Date
- Apr 2006
- Posts
- 6
(command1; command2) | command3
The output of command1 and command2 redirected to command3. The command1 is executed first, followed by command2.
- 04-30-2006 #5Just Joined!
- Join Date
- Apr 2006
- Posts
- 10
How do I use that to start a shell interpreter like bash, pipe some first commands to it, and then give control to the user? It is not necessary that the user has no control at the beginning. I just want to "paste" some text into the bash interpreter without using the mouse and without bash exiting afterwards.
- 05-01-2006 #6Just Joined!
- Join Date
- Apr 2006
- Posts
- 6
(cat somefile; /bin/bash ) | someprog
Use Ctrl+D to stop the bash.
- 05-01-2006 #7Just Joined!
- Join Date
- Apr 2006
- Posts
- 10
No, I meant that bash should be "someprog"...

Is THAT possible?


Reply With Quote
