Starting a new bash shell from a bash shell

68,145

Solution 1

I admit this doesn't really answer your question, but I think it solves your problem.

Why not just use & to send it to the background. You can see if it's still running with jobs and bring it back to the foreground with fg, you can also send it back to the background, by first stopping it with Ctrl+Z then bg

Example to try.

> sleep 20 &
> jobs
> fg [jobNumber]
[Ctrl-Z]
> jobs
> bg [jobNumber]
> jobs

Solution 2

Try:

bash -c 'gnome-terminal -x cd /absolute-path && program_name'

Solution 3

Try screen. Its a simple brogram that allows you to keep track of multiple shells at the same time. You can navigate through each of the open shells and even leave the session and reconnect later on.

Solution 4

use the absolute path to the program or cd before calling gnome-terminal. And you need a & to put it in the background.

cd Dropbox; gnome-terminal -x "program_name" &

Solution 5

Try adding "&" at the end of your command, e.g.:

gnome-terminal &

I don't know if it's working with gnome-terminal, but it worked well with mrxvt.

Share:
68,145
providence
Author by

providence

(your about me is currently blank) click here to edit

Updated on February 26, 2020

Comments

  • providence
    providence about 4 years

    I would like to run a program from the bash shell. When the program runs, it dominates the entire shell, so I would like to start a new shell and run the program from there. Currently I am doing:

    gnome-terminal -x "cd Dropbox; program_name"
    

    However that give me the error Failed to execute the child process, no such file or directory. I believe thats because the new terminal has no time to initialize. How can I fix this?