> You are depending on American Nerd concepts and you should set LANG=C. Perhaps. Or, perhaps not. > Yes but this will cause the opposite problem. You'll not be matching, > when you think you should. (Unless you are using -v for non-matching > logic.) As usual, many things are possible, including spurious matching, even without an exotic locale. For example: dyi# echo ${LOGNAME} | grep -q [a-z] dyi# echo $? 0 dyi# echo ${LOGNAME} | grep -q [A-Z] dyi# echo $? 0 Revealing more: dyi# set -x dyi# echo ${LOGNAME} | grep [a-z] + echo root + grep a b a dyi# echo ${LOGNAME} | grep [A-Z] + echo root + grep A B A dyi# set +x dyi# ls -l ? -rw-r--r-- 1 root sys 0 Apr 14 09:05 A -rw-r--r-- 1 root sys 2 Apr 14 09:06 B -rw-r--r-- 1 root sys 0 Apr 14 09:03 a -rw-r--r-- 1 root sys 2 Apr 14 09:04 b dyi# cat B A dyi# cat b a Given enough arguments, grep doesn't have much interest in stdin, so these results don't depend on ${LOGNAME}: dyi# set -x dyi# grep [a-z] + grep a b a dyi# echo $? + echo 0 0 dyi# grep [A-Z] + grep A B A dyi# echo $? + echo 0 0 Everything's complicated, but, as shown before, quoting the RE solves problems of this type.