If you’ve never written a shell script before, this is the place to start. If you have, maybe skip this as it covers the absolute basics.

Writing a “Hello World” program is a rite-of-passage in the programming world. Here is how to do it in shell scripting (via the command line in an enterprise-grade Linux system).

Assumption: You already know how you use vim.

  1. Starting from the command line, create a new file called “HelloWorld.sh” using vim:
vim HelloWorld.sh
  1. Inside “HelloWorld.sh”, write the following:
#!/bin/bash 

echo "Hello World!"

Write <code>HelloWorld.sh</code> in <code>vim</code>"

  1. Save the file and exit using :wq

  2. Make the file executable by issuing the command chmod 700 HelloWorld.sh (see Basic Permissions for a more thorough explanation).

  3. Run your file with ./HelloWorld.sh:

Run <code>HelloWorld.sh</code>