Bash Shell Scripting QuickStart on Mac OS X 10.11 El Capitan

Mac OS X Shell Scripting QuickStart



The Tutorial Shows You Step-by-Step How-to Getting-Started Making and Running a Bash Shell Script for Mac OS X 10.11 El Capitan BSD.

Shell Scripts are files in which we write a Sequence of Commands that we need to perform and are Executed using the Shell utility.

The Bash (Bourne Again Shell) is the Default Shell environment for some BSD/Unix system.

To Edit & Save our Bash Shell Script we’ll make Use of the Default Mac Shell Editor nano.

How-to QuickStart with Bash Shell Scripting on Mac OS X - Featured
  1. Open a Shell Terminal emulator window
    (Press “Enter” to Execute Commands)

    How-to QuickStart with Bash Shell Scripting on Mac OS X - Open Terminal
  2. Editing a Bash Script on Home Directory with nano
    First we Change to our Home with

    Then we Make the Bash Script with

    To be Runnable directly as a Shell Script we append a Bash Shebang to the Top like

    Then for Testing the Execution we should Insert a classic Hello-Word greating

    The ‘echo‘ Command simply Output a String on Terminal
    So finally our simple Bash Script will be containing just

    The Sequence of Bash Commands must be a Stack of sigle Commands

    Or simply in a Line of Commands Divided by a ‘;’ SemiColon

    Ctrl+x to Save & Exit from nano Editor

  3. Executing the Hello-World Bash Script
    We Need to give the Execution Permissions with


    Then to Run our little Bash Script simply

    You’ll be nicely greeted on Shell with something like