Score:0

Script run in terminal vs Script run via Desktop shortcut

gb flag

I would like to ask what is the difference between executing script/commands via normal termianl window vs clicking on Desktop shortcut for terminal application (see the desktop shortcut at the end).

There must be some difference, because when I start command in standard terminal window and try to close during test command "sleep 100" there is warning prompt ("Close this Terminal? There is still a process..."). But when executed via Desktop icon, window is closed without any warning.

I'm asking because I'm preparing mount script for rclone that will be executed on demand after clicking desktop icon and I would like to keep that window open and "safe" from accidental clicking on close button.

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=SOME_NAME
Terminal=true
Type=Application
Exec=sleep 100
Icon=drive-removable-media
Score:1
hr flag

The difference is that Exec=sleep 100 runs the sleep command as a direct child of the terminal process:

systemd───systemd───gnome-terminal-───sleep

whereas when you type sleep 100 in a standard terminal window, there is an interactive shell in between. You can get the same behavior in a desktop application by wrapping your command in an interactive shell (it doesn't need to be a complex shell like bash):

Exec=sh -ic 'sleep 100'

so that the process tree becomes

systemd───systemd───gnome-terminal-───sh───sleep
keldorn avatar
gb flag
Thanks! Helped a lot :)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.