I am still blogging about all issues i get during string manipulations so stay on. I am building a 4000 lines long script file to do hell lot of things on AWS EC2 automation engine and since i had got too rusty on shell scripting, i though it is a good idea to keep blogging about my errors( all silly ofcourse)

The issue is if you are doing a If then else with a if [[ “your comparision here “]], you shall have a issue if you are playing with a numeric variable inside the string.

if [[“$numericval” -ne 3]]

well this doesnt work and neither this

if [[$numericval -ne 3]]

Let us see the right way as per below. Plain and simple

If else with numeric comparision in bash shell

 

and let me paste some exmaples from one of bash shell script site for your reading.

 

Numeric comparision in bash shell scripts on AWS ec2