Linux How to Execute Script

Linux How to Execute Script

There are many ways how to execute a script, the first one is to execute the script by specifying the interpreter:


For debugging use option “-x” to see what is being done.

bash -x

As an interpreter, you can use sh, ksh, csh, bash etc.

If you want to execute the script without specifying an interpreter, you need to set execute (+x) permission:

chmod +x

Then you can execute the script following way:


Another way how to run the script:


The script doesn’t need to execute permission in this example. If the script makes any changes to the environment, it will be visible after running the script, because commands in the script are executed in the current shell.

Leave a Comment