This tutorial explains how to write a batch scripts in shell script and executes it.

commands are input to OS to make a system calls and does actions. user input commands in the terminal to do operation such as ls, cd, mkdir etc.

Another way, Multiple commands can be placed in a file, bash interpreter read the commands and run

How to write a shell script in bash

  • Choose Editor or text editor
  • Create a file with extension .sh or .bash
  • Write commands in a file
  • Save the file as hello.sh
#!/bin/bash
echo "Hello World"

Change the permission to execute the file


chmod +x hello.sh