Passing commands to subprocess in shell

771 views Asked by At

If a certain command (in my case ./karaf) runs a sub-process in a shell, that accepts its own commands, is there someway to execute the subsequently listed commands in a script as commands to the subprocess? For example,

sudo ./karaf

opens a process in the shell that accepts its own commands. If I run this from a shell script, and then want the command

feature:install odl-openflowplugin-flow-services-u

to be run INSIDE the ./karaf program, how do I go about doing this?

Thank you!

1

There are 1 answers

3
deathangel908 On BEST ANSWER

You can redirect commands to karaf like:

./sudo karaf < echo 'feature:install'

But I wouldn't recommend you to do that. You see shell will pass the command imidiatelly to karaf which isn't ready to accept those commands (I assume it takes some time for karaf to initialize itself)

Instead you'd better execute command via karaf client.

./bin/client feature:install