0

I created a simple shell script and copied it onto desktop on the following systems:

On Linux Mint Cinnamon 17.3 Beta: It asks me every time whether I want to Run in terminal, which I would like to always do. I am curious on how to make it run without asking?

On Linux Mint KDE 17.2: Whatever I tried, I can't figure out, how to execute the script from desktop. I have copied it onto desktop using mouse and set 755 permissions via GUI. It doesn't do anything when I click on it. What do I have to do next?

The script contains only two commands, it's meant to upgrade packages on demand:

#!/bin/bash
sudo apt-get update && sudo apt-get upgrade
  • where is the script?. I mean, in what directory?. Then, start a console (terminal) application like (KDE) konsole, cd to the directory above (write cd dir), then write bash ./script . This seems just too basic. Find a tutorial, read, learn, come back. – user79743 Nov 24 '15 at 8:23
  • You probably want to create a launcher on the desktop that runs the script. – Benjamin Staton Nov 24 '15 at 18:06
  • @BenjaminStaton Yes, that is correct. I don't know if the script actually copied itself on the desktop while I dragged it on it by mouse or the system did something else. – LinuxSecurityFreak Nov 24 '15 at 18:13
  • @BinaryZebra I dragged it from home folder onto desktop. As I said to BenjaminStaton. – LinuxSecurityFreak Nov 24 '15 at 18:15
  • You don't want to drag it over; you want to leave it in place and create a launcher that points to it. There's a tutorial at techrepublic.com/blog/how-do-i/…. – Benjamin Staton Nov 24 '15 at 18:19
1

You're gonna need a launcher (.desktop file). The options you want are:

  • Exec=gksudo -k -u root /path/toyourscript.sh Tells the system what to execute and that it needs to be executed as root. You could also simply type in your script here instead of specifying the path to its file, but that's... dirty.
  • Terminal=true Makes it open in terminal

Also, you probably should use dist-upgrade because it's more stability-friendly. This is how my .desktop looked when I was doing something like that:

[Desktop Entry]
Encoding=UTF-8
Name=Updater
Comment=short script
Type=Application
Exec=gksudo -k -u root /home/andrzej/Documents/update.sh
Terminal=true
Categories=

upgrade and dist-upgrade should also require confirmation. When you run them in terminal you can simply type y and press enter, but if you run it with .desktop it will close on confirmation, so you need to add -y option, like this: sudo apt-get dist-upgrade -y

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.