ozo, picked up the typo in the commaCount variable.
You are correct in your assumption about the elif tests. As soon as one of the if blocks is true, none of the other blocks are processed.
The difference between [ and [[ is that the former is effectively an alias for the /bin/test binary, whereas [[ uses the shell builtin test operator (for ksh and bash). Addtionally, the built in test operator has additional tests over the test binary, but do be aware it is shell specific.
Another way of handling the test for the ; is to do
if [[ $lastChar != ";" ]]; then
echo "This file contains a carriage return in the TEHelper.logMessage(). Please remove all carriage returns." >> $LOG_OUTPUT_FILE
continue
fi
The continue will continue to the next iteration of the while loop.
Main Topics
Browse All Topics





by: ozoPosted on 2007-10-30 at 11:55:34ID: 20179945
did you mean to say
$commaCount -gt 3
see
man test
NAME
test, [test -- condition evaluation utility
SYNOPSIS
test expression [test expression ]
DESCRIPTION
The test utility evaluates the expression and, if it evaluates to true,
returns a zero (true) exit status; otherwise it returns 1 (false). If
there is no expression, test also returns 1 (false).
and
man bash
[[ expression ]]
Return a status of 0 or 1 depending on the evaluation of the
conditional expression expression. Expressions are composed of
the primaries described below under CONDITIONAL EXPRESSIONS.
Word splitting and pathname expansion are not performed on the
words between the [[ and ]]; tilde expansion, parameter and
variable expansion, arithmetic expansion, command substitution,
process substitution, and quote removal are performed.