Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 89178 - test command doesn't know -l switch
Summary: test command doesn't know -l switch
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Aron Griffis (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-15 06:58 UTC by Clock
Modified: 2005-04-20 13:53 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Clock 2005-04-15 06:58:39 UTC
man test:"INTEGER may also be -l STRING, which evaluates to the length of STRING."

bash-2.05b$ test [ -l "bla" -ge 4 ]
bash: test: too many arguments

also, info test doesn't list the "-l" switch.

Reproducible: Always
Steps to Reproduce:
1.test [ -l "bla" -ge 4 ]
2.
3.

Actual Results:  
test: too many arguments

Expected Results:  
$?=1

It looks like the manpage is outdated
Comment 1 Aron Griffis (RETIRED) gentoo-dev 2005-04-20 13:53:01 UTC
Actually, there are multiple levels of user error in play here.  First, by default when you call "test" at the command-line, you get the bash builtin version.  The bash builtin version is documented in the bash man-page and also via "help test"

To get the external version, i.e. the version that comes with coreutils and is documented in test(1), you need to call it explicitly:

  /usr/bin/test 3 -eq -l "abc"

Second, you're misusing the command.  /usr/bin/test and /usr/bin/[ are the same command.  Never should you be calling "test [ ... ]", rather you do either "test ..." or "[ ... ]"

Finally, all of these things are in fact documented in "info test"; I just checked.