Bash Hello World! Script Tutorial

As with any Programming or Scripting Language, let us take a look at the very basic two lines script called "Hello World!" in Bash!

The best way to learn and write Shell Scripts is by making use of editors like vi or nano, in this example, we will make use of nano,

Step by Step Hello World! Bash Scripting Example

  1. Open Terminal,
    Step 1 - Open Terminal
  2. Type nano and press enter, this will open Nano Editor for you,
    Step 2 - Open Nano
  3. Write the below code,
    echo Hello World!
    Step 3 - Write Hello World code
  4. Press Control + X and then Y to save.
  5. Now run command chmod +x just to make sure we can execute this script,
  6. Type ./
Result of running bash hello world script

Congratulations! You ran you first bash script successfully!

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap