As with any Programming or Scripting Language, let us take a look at the very basic two lines script called "Hello World!" in Bash!
The best way to learn and write Shell Scripts is by making use of editors like vi or nano, in this example, we will make use of nano,
Step by Step Hello World! Bash Scripting Example
- Open Terminal,
- Type nano helloWorld.sh and press enter, this will open Nano Editor for you,
- Write the below code,
#!/bin/bash echo Hello World!
- Press Control + X and then Y to save.
- Now run command chmod +x helloWorld.sh just to make sure we can execute this script,
- Type ./helloWorld.sh

Congratulations! You ran you first bash script successfully!
More Posts related to Bash,
- How to start or open a new bourne-again shell (bash) session on Windows using Command Line CMD
- How to create new user account in Windows bash
- Bash Hello World! Script Tutorial
- How to Compare Strings in Bash
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- Command to Sort File In Reverse Order [Unix/Linux/macOS]
- Bash command to wait for seconds
- [fix] bash: ssh: command not found
- bash: netstat: command not found
- Know Bash shell version command
- List all Username and User ID using Bash Command
- How to use Autocomplete and Autosuggestion in Shell Commands
- How to know the current shell you are logged in?
- [Fix] bash: script.sh: /bin/bash^M: bad interpreter: No such file or directory
- 'pwd' is not recognized as an internal or external command, operable program or batch file. [Windows]
- How to Kill a port using bash terminal command?
- How to fix bash ping command not found error
- Install Bash Completion on macOS
- bash get year 2021 calendar
- How to check your IP using bash for Windows?
- Bash For Loop Example
- Fix bash: script.sh: Permission denied Error
More Posts:
- Add blank lines after each lines using Notepad++ text editor - NotepadPlusPlus
- How to Display Excel Spreadsheet on SharePoint site - SharePoint
- How to start Microsoft Teams on Mac Startup - Teams
- How to press shortcut CTRL + ALT + DEL on Windows Remote Desktop - HowTos
- [Android] RuntimeException: Unable to start activity Need BLUETOOTH permission - Android
- macOS Ventura: In order to use Xcode.app you need to update to the latest version - MacOS
- Safari Full Screen Shortcut using Keyboard [macOS] - MacOS
- What is FCM Messages Test Notification! [Microsoft Teams] [Google Hangouts] - Microsoft