Terminal closing when shell command is cancelled

Good morning fellas, i’m writing a shell script to open multiple terminal window for my nodejs projects, is there a way to cancel the command pre-programmed in the shell and still use the terminal in the directory it was open? When i run my script it opens the terminals and run my command “npm run dev” but when i type “ctrl+c” the entire terminal is shutdown instead of just the npm command, heres my script:

xfce4-terminal --working-directory=/home/dalton/repos/ufchat/api_gateway --title=“GATEWAY” -e “npm run dev”

I also have tried:

xfce4-terminal --working-directory=/home/dalton/repos/ufchat/api_gateway --title=“GATEWAY” -e “npm run dev” -H

According to manual you could use –hold to achieve what you want

https://docs.xfce.org/apps/xfce4-terminal/command-line

You have tagged this in a strange manner gnome-shell and xfce - two things not narmally used in the same sentence.

1 Like

Sorry, i was selecting a shell topic and didn’t read the gnome part, but still using the --hold my terminal just freeze after typing “Ctrl+C”

If you launch the the xfce4-terminal from a script - it is normal the window closes when script is finished.

If you want the window to stay open instead of closing you use –hold.

I think what you are looking for is something like nohup

man nohup

Credit Mount get's undone when script ends? - #2 by Aragorn

On a sidenote - please don’t be lazy - posting screenshots of text - you can copy and paste the text into your comment - but a screenshot ?

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.