Running a shell script

You can execute a shell script in these ways:

  • Invoke another shell with the name of your shell script as an argument:
    sh myscript
      
  • Load your script as a dot file into the current shell:
    . myscript
      
  • Use chmod to make the shell script executable, and then invoke it, like this:
    chmod 744 myscript
    ./myscript
      

    In this instance, your shell automatically invokes a new shell to execute the shell script.

Page updated: