To run bash script, you must follow the below steps-
chmod
command.
#chmod u+x filename
#bash filenameOR
#./filename
Let's practice the above steps with the help of a simple example-
echo "Hello Bash Shell." echo "This is my first Bash Script."
Suppose the filename is firstprogram.sh. We will assign execute permission to firstprogram.sh file.
#chmod u+x firstprogram.sh
Now, we will run this file
#bash firstprogram.sh Hello Bash Shell. This is my first Bash Script.OR
#./firstprogram.sh Hello Bash Shell. This is my first Bash Script.