Given the following code:
Max=
if [[ something exists.. ]]; then
     Max=2
// .. more code that can changes the value of Max
fi
// HERE
How can I check at "HERE" if Max is equal to some number (setted)?
Given the following code:
Max=
if [[ something exists.. ]]; then
     Max=2
// .. more code that can changes the value of Max
fi
// HERE
How can I check at "HERE" if Max is equal to some number (setted)?
 
    
     
    
    Cool !
Max is set by default to an empty value, that when used in an arithmetic context, returns zero. For example:
Try running echo $(( definitelyNotAGivenName)) it comes out as zero, cool! 
You can use the round brackets for arithmetic comparing - see more here and here
 
    
    if [ -z "$Max" ]
then
  echo "Max: not set"
else if [ $Max -eq some_number ]
then
  echo "Max is equal to some number"
else
  echo "Max is set but not equal to some number"
fi
or
if [ -n "$Max" -a "$Max" = "some_number" ]
...
Notice that the second example is doing a string comparison which can solve some headaches but may hurt the sensibilities of purists.
