Bug 7727 - man-page mistake
: man-page mistake
Status: CLOSED NOTABUG
: Sisyphus
(All bugs in Sisyphus/bash)
: unstable
: all Linux
: P2 normal
Assigned To:
:
:
:
:
:
  Show dependency tree
 
Reported: 2005-08-21 20:51 by
Modified: 2005-12-31 02:26 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2005-08-21 20:51:45
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 From 2005-12-31 02:26:43 -------
You just should not forget to quote < and > characters, e.g.

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