string comparison not working inside while loop

The string comparison highlighted below is not working fine. Please help:

while read line
do
    # Get File name by deleting everything that preceedes and follows Filename as printed in cvs status' output
    f_name=`echo $line | sed -e 's/^File:[ ^I]//' -e 's/ *Status:.*//' | awk '{print $NF}'`
    f_status=`echo $line | cut -d ":" -f3`
    if [[ "${f_status}" == "Needs Checkout" ]]; then
    f_path='Only in Repository';  echo "$f_name | $f_status | $f_path" >> $out1; continue; fi
    find /home/ustst/ -name "$f_name" -print > $f_out
    find_out=`cat $f_out|wc -l`
    if [ $find_out -eq 1 ]; then path=`cat $f_out`; f_path=`dirname $path`; echo "$f_name | $f_status | $f_path" >> $out1; fi
    if [ $find_out -gt 1 ]; then
 
        while read $file
        do
            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" >> $out1
            fi
            cd - > /dev/null
        done < $f_out
    fi
done < $out

Even if f_status=Needs Checkout, it is still not going inside the if condition.

Looks fine to me.

$ f_status="Needs Checkout"
$ if [[ "${f_status}" == "Needs Checkout" ]]; then echo hello; fi
hello

not sure if it helps,

look for any hidden character in the line.
if you have copy-pasted the script/line then then try to re-type it

Hi.

I suggest you look at the content of the variable. Here are some methods:

#!/usr/bin/env bash

# @(#) s1	Demonstrate 3 ways to see value of string.

# Utility functions: print-as-echo, print-line-with-visual-space.
pe() { for i;do printf "%s" "$i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }

f_status="Needs Checkout"

pl " Method 1: print bounded by some character to show whitespace:"
echo " f_status is :$f_status:"

pl " Method 2: use utility to show all characters:"
echo " f_status details:"
echo "$f_status" | od -bc

pl " Method 3: use shell to show details of operations:"
set -x
if [[ "${f_status}" == "Needs Checkout" ]]; then echo hello; fi

exit 0

producing:

% ./s1

-----
 Method 1: print bounded by some character to show whitespace:
 f_status is :Needs Checkout:

-----
 Method 2: use utility to show all characters:
 f_status details:
0000000 116 145 145 144 163 040 103 150 145 143 153 157 165 164 012
          N   e   e   d   s       C   h   e   c   k   o   u   t  \n
0000017

-----
 Method 3: use shell to show details of operations:
+ [[ Needs Checkout == \N\e\e\d\s\ \C\h\e\c\k\o\u\t ]]
+ echo hello
hello
+ exit 0

Good luck ... cheers, drl

At first glance, the script looks fine to me, so the easiest way of tracking what's happening would be using activating bash debugging utility just prior to that specific line of code: "set -x".
This will cause every subsequent standard output to come output (each line) to start with a "+" character. The magic is that, it allows you to see exactly what is taking place within you coding sequence. In other words, what variables are correctly assigned or not and many more details.

It's a very helpful debugging utility.
have fun!