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

Revision #1
Created 11 January 2023 15:30:34
Updated 21 July 2024 15:11:16