Skip to main content

Make script executable

In order to make sure that a file ending in .sh can be executed, you have to change its permissions. This is necessary if a script is to be executed by an automation like Ansible or Crontab.

chmod +x /path/to/yourscript.sh

Afterwards it can be called by its relative or absolut path. Sometimes you have to specify the interpreter path such as /bin/bash.

/path/to/yourscript.sh
./yourscript.sh
/bin/bash /path/to/yourscript.sh