Re: Substring search in dash [ _NOT_ bash ] shell
Hi,
Greg Wooledge wrote:
> https://lists.gnu.org/archive/html/bug-bash/2015-07/msg00125.html
which states
$ test -n '<' -a true
-bash: test: too many arguments
This looks rather like the effect of having an operator named '<':
$ test 1 '<' 2 && echo yes
yes
$ test 3 '<' 2 && echo yes
$
One gets the same problem with traditional operator '='
$ test -n '=' -a 1 = 1 && echo yes
bash: test: too many arguments
because the parser of "test" wants to be smart with this
$ test -n '=' -a || echo no
no
$ test -n '=' && echo yes
yes
The problem gets covered if only three arguments are given to "test"
or if the reserved operator name is not the second argument.
This is well an argument against attempts to be smart with "test",
i have to confess.
Have a nice day :)
Thomas
Reply to: