0

All my bash scripts (which I always gave the permission to be executed) works but without open the Konsole.

So if I made the script:

#!/bin/bash
mkdir t

When I double-click it I find a new directory called "t". And so, all scripts which doesn't contain "sudo".

But If I write

#!/bin/bash
sudo apt-get install vlc -y

#or any othe script with "sudo"

The script doesn't work. It doesn't open a shell to asking me the password for using "sudo". And it doesn't install vlc.

It works only if I execute it using terminal, but I need a script which works when I double-click it.

How can I do?

  • Why would you expect a command to run in the terminal if you don't tell it to? Simply use gksudo. Definitely a dupe of something. – Jacob Vlijm Oct 10 '15 at 20:22
1

Run the terminal from the script.

#!/bin/bash
xterm -e sudo apt-get install vlc -y

Other terminals might have a different way how to run a command than -e.

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.