Bash Shell Scripting Quick-Start on Ubuntu 15.10 Wily Linux

January 9, 2016 | By the+gnu+linux+evangelist.

Linux Ubuntu Shell Scripting Quick Start




Hi! The Tutorial shows you Step-by-Step How to Getting-Started Making and Running a Bash Shell Script for Ubuntu 15.10 Wily GNU/Linux.

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 most GNU/Linux system.

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

How to Quick Start with Bash Shell Scripting on Ubuntu - Featured
  1. Open a Shell session
    Ctrl+Alt+t to open a Terminal emulator on Desktop
    (Press “Enter” to Execute Commands)

    How to Quick Start with Bash Shell Scripting on Ubuntu - Open Terminal
  2. Editing a Bash Script on Home Directory with nano
    First, we Change to our Home with

    cd ~

    Then we Make the Bash Script with

    nano mybashscript.sh

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

    #!/bin/bash

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

    echo 'Hello World!'

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

    #!/bin/bash
    date/necho 'Hello World!'/necho 'From the Bash Shell'
    

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

    myBashCommand1
    myBashCommand2
    ...
    

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

    myBashCommand1 ; myBashCommand2 ...

    Ctrl+x to Save & Exit from nano Editor

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

    chmod +x ./mybashscript.sh

    Then to Run our little Bash Script simply

    ./mybashscript.sh

    You’ll be nicely greeted on Shell with something like

    Sun Jan 10 10:31:26 PST 2016
    Hello World!
    From the Bash Shell
    

QuickChic Theme • Powered by WordPress