How to write a Linux Shell Script

Begin with (assuming bash)

#!/bin/sh

then
Add your content

then
$ chmod a+x my-script

$ ./my-script – runs your script

optional
a move to /usr/local/bin would make the script work with just my-script

optional
$ source my-script
$ .my-script

Advertisements

Leave a Reply

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