What Is Bash?

Bash stands for Bourne Again SHell. It is the default shell on most Linux systems. It allows you to:

  • Run commands interactively
  • Write scripts (files containing commands) A bash script is simply a text file with Linux commands executed line by line.

First Bash Script

Step 1: Create a file. vim kervie.sh This opens vim in Normal mode.

Step 2: Go to insert mode by pressing i.

Step 3: Add this content

#!/bin/bash
echo "Hello, World!"

Step 4: Save and exit Press Esc then type :wq. to save the file.

Understanding the Script

#!/bin/bash

It is called the shebang. It tells Linux to use Bash to execute the script.

echo "Hello World!"

Prints text to the terminal.

Making the Script Executable

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help