In man-page contains the wrong information: ... string1 < string2 True if string1 sorts before string2 lexicographically in the current locale. string1 > string2 True if string1 sorts after string2 lexicographically in the current locale. ... Constructions "<" and ">" is illegal. [legion@legion testdir]$ ls -l total 4 -rwxr-xr-x 1 legion legion 134 Aug 21 19:32 test.sh [legion@legion testdir]$ cat ./test.sh #!/bin/zsh export LC_ALL=C LANG=C LANGUAGE=C if [ "a" < "b" ]; then echo "a < b" fi if [ "a" > "b" ]; then echo "a > b" fi [legion@legion testdir]$ ./test.sh ./test.sh:5: no such file or directory: b a > b [legion@legion testdir]$ ls -l total 4 -rw-r--r-- 1 legion legion 0 Aug 21 20:12 b -rwxr-xr-x 1 legion legion 134 Aug 21 19:32 test.sh [legion@legion testdir]$ Bash consider ">" and "<" operations at the "[...]" constructions as redirections. This operations don't work in zsh, ash too, but are described in their man-pages. What suggestions?
You just should not forget to quote < and > characters, e.g. $ if [ a \< b ]; then echo lt; fi lt