Bash Script: Simple text file that stores a series of commands, typically entered in the command line, to automate tasks in the Linux system.

How to Write Bash Scripts?

Ensure you're in the desired directory by using pwd command and if not then change to desired directory using cd command

  1. Create file with .sh extension:
Screenshot 2024-08-08 at 5.30.00 PM.png

Execute the Script prefixing with ./file_name

  1. Open the script in text editor:

gedit apoo.sh

If gedit is not installed then run brew install gedit

  1. Write down the bash script command within it:

💡 Every Bash script for Linux should start with the shebang line- "#!/bin/bash"

Let’s start with the programming ritual- ‘Hello World’

Screenshot 2024-08-08 at 5.29.03 PM.png

If you excecute this file now, it will give permission denied.

  1. Provide execution permission and execute it:
Screenshot 2024-08-08 at 5.03.49 PM.png