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.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Comment:

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: