How do I create an executable for a shell script in Ubuntu?

I wrote a simple wrapper script called decBright.sh that dims the screen brightness every time I run it. However, I don't want to open a terminal and execute bash decBright.sh

every time.

Instead, I want to create some kind of executable that I can place on my Desktop that will run my script on double click. One answer I found here on the askUbuntu forums did not work for me.

Is there any other way to do this?

I am using Ubuntu 14.04 (Trusty Tahr)

+3


source to share


1 answer


An executable in linux is a file with an executable bit. So you just change it with chmod

:

chmod +x decBright.sh

      

Then you can start it with:

./decbright.sh

      



You can also launch it by double clicking on many graphical Linux distributions.

You're also better off providing "Shebang": the first line of your script should specify "interpreter":

#!/bin/bash

      

Or any other interpreter ( on the first line of your file ).

+1


source







All Articles