fbpx

Learn to write your first shell script to print “Helloworld”?

Come lets Learn to write your first shell script will be the baby step for learning shell programming.

Any programming language or script it be, start it with “Hello world”.

Why start with Hello world?

Writing your first program to print “Hello world”, will allow you to learn the basic setup of the environment, configurations, and more.

https://youtu.be/yxmI8pS2wN0

hello_world.sh

#!/bin/bash
echo "Hello world"

Save the file, then to run open the terminal, and type ./hello_world.sh

PS: You might get permission denied error, due to hello_world.sh file not having execute permission for any users.

Use “chmod +x hello_world.sh” to provide execute permission.

This first line (#!/bin/bash or #!/bin/sh) has a name. It is known as ‘she-bang‘ (shabang). This derives from the concatenation of the tokens sharp (#) and bang (!).

It is also called as sh-bang, hash-bang, pound-bang or hash-pling. In computing, a she-bang is the character sequence consisting of the characters number sign and exclamation mark (#!) at the beginning of a script.
Learn to write your first shell script
~3Minutes: Tutorial

Share This