I am logged to a system in /bin/bash, as a regular user, then I need run a perl script which in turns starts a ksh shell. After the perl script is done both shells are alive (bash and ksh) How can i write a script which will be triggered from bash, then it will launch the perl script, and subsequent commands need to be run in the new launched ksh.. as of now commands writen after the perl script hang.. and are run until I exit ksh.. I am able to see both SHELLs PID but do not know how to run a commands in the second one while script is run in the first one..



##call perl command which initiates a ksh among other stuff
$pathtoperl/perlscript -arguments

command3     #need to be run in new ksh, not in current /bin/bash
command4     #need to be run in new ksh, not in current /bin/bash
  • You'll probably want to use a server:client model: the ksh shell can listen to a port where you can send commands, and the shell can eval them. Commented Feb 16, 2017 at 14:42

1 Answer 1


IF you are the parent or sibling process, you can keep a reference to stdin of the ksh process and send commands that way, but generally, you can't send commands to a random running process in this way. So in your example, you could use the perl script to send commands to the ksh on stdin. But your login bash script doesn't know about the running ksh after the perl script exits.

  • The perl script is maintained by different team, and shared on the same server. I would rather to be able to execute command3 and 4 from outside of perl script. Commented Feb 15, 2017 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .