I wrote a simple .desktop program with accompanying script. It worked recently but seems to have stopped for no reason. It now just opens a terminal (expected) but instead of running the rest of the program it instantly closes the window. Basically it opens then instantly closes the terminal window without running (or so it seems) any of the script.
Here is the code for both, the script first, then the .desktop file:
#!/bin/bash selection= until [ "$selection" = "ENTER" ]; do echo " SHUTDOWN: C - Cancel shutdown and quit ENTER - Accept shutdown timer (3 hours) and quit " read selection echo "" case $selection in [Cc]) exit;; "") echo "Shutting down... 'sudo shutdown -c' to cancel" sleep 5 sudo shutdown -h 180 *) echo "Please enter either C or Press [ENTER]" esac done
here's the Desktop file:
[Desktop Entry] Name=Shutdown Script Comment=shutdown in 3 hours Exec="/home/nate/Update-Clean/shutdown script" Terminal=true Type=Application Icon=/home/nate/Update-Clean/icons/computer-fail.png Name[en_US]=Shutdown
How did it stop working?!
(Also, if you hadn't noticed, I want a simple script to shutdown the computer after a certain time. This is only the 2nd thing I've written so if it has errors or you have constructive criticism, by all means!)
Thanks a ton!
I added a simple "exit;;" to the script. Could that have been all?
case $selection in [Cc]) exit;; "") echo "Shutting down... 'sudo shutdown -c' to cancel" sleep 5 sudo shutdown -h 180 exit;; *) echo "Please enter either C or Press [ENTER]"