How can I determine if a script was invoked from a command line or via double-click in file manager (Nautilis)?
If the former, I still have a command prompt when the script finishes, but if it was double-clicked (or executed via a .desktop file), the script executes in a window and then disappears. I want the window to remain open with a command prompt.
I figure the script could make this check and either do nothing - if invoked from a command line - or exec
bash at the end if invoked via double-click or .desktop.
Haven't been successful using methods to check if interactive or not or tty.
.desktop
file call your script in a command terminal and execute it. The first answer here with the lineExec=gnome-terminal -e "bash -c 'echo hello;$SHELL'"
worked well when I tested it on my system. I changed theecho hello
to my own script.