Bash scripting hello world

Hacking Truth
0






In Linux, all tasks from execution of services to loading and unloading of modules are carried out by programs and all programs need to be executed. You use the commands to access all the basic features of kernel. Shell scripting is a way to automate such tasks, and bash is one of the language, that has capabilities enough to be called as scripting as well as a language that can be used for programming on the POSIX platform, for small tasks. Bash scripting hello world


Consider, you usually update the system with following commands executed one after another.


sudo apt-get update

sudo apt-get upgrade

sudo apt-get autoclean

sudo service apache2 start

sudo service mysql start

sudo service mysql status

sudo service apache2 status




Bash scripts can be used for various purposes, such as executing a shell command, running multiple commands together, customizing administrative tasks, performing task automation etc. So knowledge of bash programming basics is important for every Linux user. This article will help you to get the basic idea on bash programming. Most of the common operations of bash scripting are explained with very simple examples here.




Hello World



Create and Execute First BASH Program:

You can run bash script from the terminal or by executing any bash file. Run the following command from the terminal to execute a very simple bash statement. The output of the command will be ‘Hello World’.



$ echo "hello world"





Open any editor to create a bash file. Here, nano editor is used to create the file and filename is set as ‘First.sh’


$ nano hello.sh



Add the following bash script to the file and save the file.


#!/bin/bash

echo "Hello World"

echo "Hello Viewers"





You can run bash file by two ways. One way is by using bash command and another is by setting execute permission to bash file and run the file. Both ways are shown here.


$ bash hello.sh

Or,

$ chmod a+x First.sh
$ ./First.sh











I hope you liked this post, then you should not forget to share this post at all.
Thank you so much :-)

 

Disclaimer


This was written for educational purpose and pentest only.
The author will not be responsible for any damage ..!
The author of this tool is not responsible for any misuse of the information.
You will not misuse the information to gain unauthorized access.
This information shall only be used to expand knowledge and not for causing  malicious or damaging attacks. Performing any hacks without written permission is illegal ..!


All video’s and tutorials are for informational and educational purposes only. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. We believe that it is impossible to defend yourself from hackers without knowing how hacking is done. The tutorials and videos provided on www.hackingtruth.in is only for those who are interested to learn about Ethical Hacking, Security, Penetration Testing and malware analysis. Hacking tutorials is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used.


All tutorials and videos have been made using our own routers, servers, websites and other resources, they do not contain any illegal activity. We do not promote, encourage, support or excite any illegal activity or hacking without written permission in general. We want to raise security awareness and inform our readers on how to prevent themselves from being a victim of hackers. If you plan to use the information for illegal purposes, please leave this website now. We cannot be held responsible for any misuse of the given information.



- Hacking Truth by Kumar Atul Jaiswal



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)
Our website uses cookies to enhance your experience. Learn More
Accept !