linux how to execute script


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


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

bash -x

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

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

chmod +x

Then you can execute script following way:


Another way how to run script:


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

Was this information helpful to you? You have the power to keep it alive.
Each donated € will be spent on running and expanding this page about UNIX Shell.