You don't need this backslash - it's not a C shell.
The problem is that the while loop is in the sub shell, which ends, but because it starts as a sub shell, the main script continues.
In the context, perhaps the simplest fix:
while read line
do
line=`echo $line | tr "[:lower:]" "[:upper:]"`
if [ "`echo $line | cut -f1 -d:`" = "foo" ] &&
[ "`echo $line | cut -f2 -d:`" = "bar" ]; then
echo 'exist'
exit 1
fi
done < $1
('cat' $@"'' cat $1 '), lot harder :
cat "$@" |
while read line
do
line=`echo $line | tr "[:lower:]" "[:upper:]"`
if [ "`echo $line | cut -f1 -d:`" = "foo" ] &&
[ "`echo $line | cut -f2 -d:`" = "bar" ]; then
echo 'exist'
exit 1
fi
done
[ $? != 0 ] && exit 1
, "cat" "while", while, 1 , "foo: bar" .
, , :
grep -s -q "^foo:bar:" "$@" && exit 1
, . ( '^ foo: bar $', egrep grep.)