The script basically has output that the user should read. I was thinking of this:
#!/bin/bash #cd to the script dir if executed from outside SCRIPT_PATH=$(dirname "$(readlink -f "$0")") cd "$SCRIPT_PATH" if [ ! -t 1 ]; then #not from terminal SCRIPT=$(basename "$(readlink -f "$0")") x-terminal-emulator --profile "$USER" --working-directory "$SCRIPT_PATH" -e "./$SCRIPT" & exit 0 fi echo "output" #keep terminal open bash
but this has the problem that if you try to close the window of the new terminal (when executed from nautilus, pgrep says only one bash process) or the 'old' terminal (when executed from a already open terminal, pgrep says two bash processes), that "There is still a process running in this terminal. Closing the terminal will kill it."
I'm looking for a complete solution: can run from a open terminal, can run from nautilus or another file manager, will always allow the user to read output, won't leave processes hanging when exits and won't show that warning on the user innocently closing the window.
I'm pretty sure that the 'process' making the visible console show that warning is the
bash at the last line, but that bash is the only thing allowing the echo to be seen if the script is run from nautilus.