Shell Script Tutorial for Beginner-Hello World

Shell scripting is an effective way to manage our Linux server via Terminal command. Shell script can automate repetitive tasks easily. In this blog, I will try to write tutorials about Shell script. Shell script is very easy to learn. On this first post, lets start with Hello World script. 
Requirements
  • Linux OS (Manjaro or any other Linux variants)
  • Terminal console
  • Text editor such as nano or vim. But here I will use nano because I am not familiar with vim. You can also use Atom, a more powerful text editor for Linux. 

Hello World

Lets create our first program called hello-world.sh. Open Terminal and type the following line. 
nano hello-world.sh
The command above will create a new file called hello-world.sh using nano. Now, add the following lines to the new file:
#!/bin/bash
echo "Hello World"
exit 0
Now close the file using CTRL + X combination. 

Executing the Script

This new file is not executable yet. We need to make it executable with this command:
chmod +x hello-world.sh

Now, lets execute this script:
./hello-world.sh

1 comments:

thank you for this tutorial. I would like to tell my system with every startup to disable touchpad. I've managed to do it once via xinput,, but system doesn't remember my disabling on next startup


EmoticonEmoticon