Bash tutorial 101

I recently came across a few comments about bash scripting and figured I would share a simple tutorial for creating your first bash script.

1. Hello World Bash Shell Script

First you need to find out where is your bash interpreter located. Enter the following into your command line:

Open up you favorite text editor and a create file called Insert the following lines to a file:
NOTE:Every bash shell script in this tutorial starts with shebang:”#!” which is not read as a comment. First line is also a place where you put your interpreter which is in this case: /bin/bash.
Here is our first bash shell script example:

Navigate to a directory where your is located and make the file executable:

Now you are ready to execute your first bash script:

Share on FacebookShare on Google+Email this to someoneShare on RedditShare on LinkedInShare on TumblrTweet about this on TwitterShare on StumbleUpon

Leave a Reply

Your email address will not be published.