Reputation: 3
I am trying to run unix commands using java Processbuilder. It creates sub processes each time new command is given. How can i run all commands in same session ? I am trying to implement 1. & - puts job in background 2. Fg (id) brings job in foreground 3. Jobs - display current background processes in same terminal.
How can I achieve this ?
Upvotes: 0
Views: 588
Reputation: 2102
Best way to run command simultaneously is put all command in one scrip file an and then run that script file using Processbuilder
You can pass parameters as well.
$ cat myscript
#!/bin/bash
echo "First arg: $1"
echo "Second arg: $2"
$ ./myscript hello world
First arg: hello
Second arg: world
Upvotes: 1