String comparison not working inside while loop

Hi,
In the code included below, the string comparision is not working fine. Please help

      
      while (( find_out >= i ))
      do
        file=`head -$i f.out|tail -1`
        dir=`dirname $file`
        cd $dir
        Status=""
        if [ -d CVS ]; then
          Status=`cvs -Q status $f_name|grep Status|cut -d ":" -f3`
        fi
        if [ -n "$Status" ] && [ "$Status" != "Up-to-date" ]; then
          echo "$f_name | $Status | $dir" >> /home/ustst/out1
        fi
        cd -
      let i=i+1
      done

Here, though it gets subsituted as [ Up-to-date != Up-to-date ], it still goes inside the if condition.

if [[ -n "$Status" && "$Status" != "Up-to-date" ]]; then

and also try using curly braces around variables when used in conditions especially.

${Status}

Thanks a lot. It worked :slight_smile: