How to use If condition in bash or shell script with examples.
This is a simple bash script or shell script to find greatest of two numbers.
read function used to get input from the user
-gt = Greater than
Note: if you get this message, this means you need to add an execute (x) permission to the bin/greatestOfTwo file.
bash: ./greatestOfTwo.sh: Permission denied
Run the following command
$ chmod +x greatestOfTwo.sh
Now let's execute
$ ./greatestOfTwo.sh Enter First Number: 23 Enter Second Number: 34
Greatest is 34
I hope this may help you.