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!
- How to create new user account in Windows bash
- Command to Sort File In Reverse Order [Unix/Linux/macOS]
- '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 know the current shell you are logged in?
- Bash For Loop Example
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- How to fix bash ping command not found error
- Know Bash shell version command
- Bash Hello World! Script Tutorial
- How to check your IP using bash for Windows?
- [Fix] bash: script.sh: /bin/bash^M: bad interpreter: No such file or directory
- Fix bash: script.sh: Permission denied Error
- Bash command to wait for seconds
- How to use Autocomplete and Autosuggestion in Shell Commands
- bash get year 2021 calendar
- bash: netstat: command not found
- How to Compare Strings in Bash
- How to start or open a new bourne-again shell (bash) session on Windows using Command Line CMD
- How to upload file programmatically to SharePoint Document Library using Server Object Model C# .Net - SharePoint
- Best free Decompiler for Java - Java
- How to install homebrew (brew) on M1 Mac - MacOS
- How to come out of dquote prompt in Terminal - macOS/Linux - MacOS
- PowerShell git: The term git is not recognized as the name of a cmdlet - Microsoft
- How to clear Mac Terminal screen - MacOS
- How to know list of images available on your device - Docker
- Eclipse Error The JVM Shared Library JavaVirtualMachines does not contain the JNI_CreateJavaVM symbol - Eclipse