Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

Basic Specs - Ubuntu 13.10, Gnome 3 (session fallback), Ambiance theme, Faenza icons.

I recently installed XAMPP, now everytime i want to use the program i have to run the sudo /opt/lampp/lampp start command, im quite new at ubuntu but i know my way around some things and i knew i can make a shell script to start the program when i double click on it, so, i open nano in the terminal and write:

#!/bin/bash/
sudo /opt/lampp/lampp start

I save it as "lampp.sh" at my home dir and give it the proper permissions chmod +x lampp.sh and chmod +775 lampp.sh. When i double click on it absolutely nothing happens, in order for it to work i have to open a terminal and run the the script there ./lampp.sh.

If i have to open the terminal each time i want to run the script then the script it self is worthless (specially when runing the sudo /opt/lampp/lampp start is 1 line of code), is there anyway i can run it on double click?

Thanks in advance, i love this community.

share|improve this question

marked as duplicate by Radu Rădeanu, guntbert, Eric Carvalho, waltinator, Jorge Castro Jan 27 at 21:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 1 down vote accepted

The opening stanza should be

#!/bin/bash

... There isn't a trailing slash.

sudo is also going to want a password every time. You can either:

  • Add an exception to /etc/sudoers
  • Use a graphical sudo equivalent like pkexec or gksudo

I think on balance, just substituting in pkexec is the easiest solution.

share|improve this answer
    
Thanks @Oli im using the gksudo equivalent, its exactly what i was looking for, the password prompt is not a problem, in fact its better. Im reading about editing the sudoers now. –  Minnen Jan 27 at 0:31

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