Length of File Name

I am trying to flag files which have file names > 150 characters. I'm using the following embedded bash script as a test.
It seems as it should work, but long file names still seem to not get flagged. Any ideas of how to accomplish this?
- Code: Select all
string="$1"
length=$(echo ${#string})
if [ $length -gt 150 ]
then
exit 0
fi
exit 1
It seems as it should work, but long file names still seem to not get flagged. Any ideas of how to accomplish this?