Little Girl's Mostly Linux Blog

RunAScript

Run a script

This page was last updated on July 30, 2011.

  • Run a script in a subshell of the current shell:
  • bash scriptname

    or:

    sh scriptname
  • Run a script in the current shell:
  • source scriptname
  • Run a script if it’s not on the PATH:
  • ./scriptname
  • Run a script if it’s on the PATH:
  • scriptname
  • Grant execute permission to the owner of the script:
  • chmod u+x scriptname
  • Then run the script:
  • scriptname

Which one should I choose?


Obligatory Happy Ending

And they all lived happily ever after. The end.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Comment:

Blog at WordPress.com.

Design a site like this with WordPress.com
Get started