Bug 7727

Summary: man-page mistake
Product: Sisyphus Reporter: Alexey Gladkov <legion>
Component: bashAssignee: placeholder <placeholder>
Status: CLOSED NOTABUG QA Contact: qa-sisyphus
Severity: normal    
Priority: P2 CC: at, glebfm, ldv, placeholder
Version: unstable   
Hardware: all   
OS: Linux   

Description Alexey Gladkov 2005-08-21 20:51:45 MSD
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?
Comment 1 Dmitry V. Levin 2005-12-31 02:26:43 MSK
You just should not forget to quote < and > characters, e.g.

$ if [ a \< b ]; then echo lt; fi
lt