Hello world Shell Scripting | Arkit
The very first step to start learning shell scripting or bash scripting. Start with hello world script. Writing just echo statement can work perfect however that’s not the good practice always.
Good Practice Hello World Script
Remember to write shebang at the first line of the shell script always would be an good practice
If you question your self why shebang! Just writing the commands in series and save the file can also called as script.
Shebang is more useful when you do not have other shells installed and only bash is primary one, where you have written parameters and code compatible with only bash. If no shebang is mentioned script will be executed using current default shell and which may fail due to UN-supported parameters.
To avoid failures its an good practice to start with shebang
check bash location using whereis bash command write the same location in shebang value
#!/bin/bash or #!/usr/bin/bash
Few Details about Shell Script
It’s always good practice and mandatory is to mention purpose of the script and explanation starting with ‘#‘ hash sign

hello world
#!/bin/bash # This shell script is an Hello world script to display hello world on output # Date: 13th March 2019 # Author: Ankam Ravi Kumar # Website: server-computer.com # Repository Location: github.com/techtutorials echo "Hello World!"
How To Execute Shell Script
[user@rhel7 ~]$ bash helloworld.sh Hello World! [user@rhel7 ~]$ sh helloworld.sh Hello World! [user@rhel7 ~]$ chmod u+x helloworld.sh [user@rhel7 ~]$ ./helloworld.sh Hello World! [user@rhel7 ~]$ source helloworld.sh Hello World!
Above are the five methods you can execute shell script. That’s about First Shell Script.
Related Articles
Thanks for your wonderful Support and Encouragement