I have a variable(which is a string) which can have two values: (1)variable = null (2)variable = "some string value"
Now I have to apply a condition like:
if (variable is equal to null) then execute step 1 else execute step 2.
This script will be run in jenkins and actual value of variable will be replaced in the script in jenkins.
but my variable has just two values either null or some string "value"...but when script runs it replaces the values so when variable gets replaced it treats null also as a string..and so when i use -n it executes only the if part.....eg...if[-n variable -ge 1]..so when script runs...it gets replaced like this..[if -n null -ge 1] and it return true..which it shouldn't ..how to solve this
How do we check it in shell script?