I have a script which unexplainably forks a new Terminal instance on some Linux distributions... I'd rather it doesn't do this. Oddly, when I run the script directly (./install.sh
) the additional Terminal instance doesn't get created.
curl qz.sh | bash # warning this will install a Linux Desktop App you may not want :)
- On MacOS Mojave: Works normally
- On Ubuntu 22.04: Works normally in a VM
- On Fedora 34: Works normally in a VM
- On Ubuntu 20.10: Reportedly spawns a new terminal
- On Manjaro XFCE: Works ok until it reaches the
sudo ...
command in the script and spawns a new Terminal instance
Full source code here.
The code in question is as follows:
# Install using unattended techniques: https://github.com/qzind/tray/wiki/deployment
echo -e "Download successful, beginning the install..."
case $OSTYPE in
"darwin"*)
# Assume .pkg (installer) for MacOS
sudo installer -pkg "$TEMP_FILE" -target /
;;
*)
# Assume .run (makeself) for others
if which sudo >/dev/null 2>&1 ; then
# use "sudo" if available
sudo bash "$TEMP_FILE" -- -y
else
# fallback to "su -c"
su root -c "bash '$TEMP_FILE' -- -y"
fi
;;
esac
Question: Why does this spawn a new Terminal instance in some environments and how can I prevent this from happening?