mercoledì 19 gennaio 2011

Make a script on Ubuntu

Create a script file with a text editor
sudo gedit myScript.sh


Insert text for a simple test:

#!/bin/sh

echo Hello World
echo
echo -n Press return to continue...
read ans


In the Command section of the Launcher setup, the following would be specified:
sh /home/user/myScript.sh

Or alternatively, if the script has execute permissions:
/home/user/myScript.sh


If you want make the script executable:
sudo chmod 744 myScript.sh

2 commenti:

  1. Nice post. I have two advices for you about the last console command.
    You are the owner of the script, so you don't need to add sudo.
    When you use 744 code to add the execution permission to the script owner you change the other users permissions too. For this reason is better if you use the command:
    chmod u+x myScript.sh

    RispondiElimina
  2. Thanks Beppe! always useful your post!

    RispondiElimina