I have a variable(stageVar) getting from Datastage, and need to check whether that variable is equal to zero then replace the 100 else stageVar. After that I need to find the mod and save in variable.
I have tried the below code but am not successful.
var= if [stageVar -eq 0] ; then "100" ; else stageVar ; fi; var2='expr $var % 100'; echo $var2;
You can use this in bash:
[[ $stageVar -eq 0 ]] && var=100 || var=$stageVar
((var2 = var % 100))
echo $var2