I am trying to make a bash script to run another bash script in a new terminal window.
I used the command:
sudo gnome-terminal -e "bash file_name.sh"
This works as I want it to.
But I want to hide the second terminal window that opens. I have tried running in background using &
but it does not work like I want it to. I want the terminal window to be hidden.
Is there any way I could set the terminal window to not show up?
Well for what i have understood about Linux and the "&" optional command, it's already that what you call hidden. You may miss "disown" command so you can run the code in background while being able to close the shell.
start it in the background:
command &
then run:
disown
and close the terminal.
You can stop a foregrounded application with Ctrl+z, then start it in the background (foreground) with the bg (fg) command.
You can read the source here on a Ubuntu Forum: "How to hide terminal window?"
You could use nohup to run the process in background:
$ sudo nohup ./file_name.sh &
There will be a new process to execute file_name.sh
, output will be written to nohup.out
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With