Bug 7727 - man-page mistake
Summary: man-page mistake
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: bash (show other bugs)
Version: unstable
Hardware: all Linux
: P2 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-21 20:51 MSD by Alexey Gladkov
Modified: 2005-12-31 02:26 MSK (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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