Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #172859

Re: Substring search in dash [ _NOT_ bash ] shell

From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: Substring search in dash [ _NOT_ bash ] shell
Date 2016-09-27 18:00 +0200
Message-ID <sm2Xv-2S0-11@gated-at.bofh.it> (permalink)
References <sm2ut-2I8-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Substring search in dash [ _NOT_ bash ] shell Richard Owlett <rowlett@cloud85.net> - 2016-09-26 17:50 +0200
  Re: Substring search in dash [ _NOT_ bash ] shell "Thomas Schmitt" <scdbackup@gmx.net> - 2016-09-27 10:10 +0200
    Re: Substring search in dash [ _NOT_ bash ] shell "Thomas Schmitt" <scdbackup@gmx.net> - 2016-09-27 10:50 +0200
      Re: Substring search in dash [ _NOT_ bash ] shell Greg Wooledge <wooledg@eeg.ccf.org> - 2016-09-27 15:50 +0200
        Re: Substring search in dash [ _NOT_ bash ] shell "Thomas Schmitt" <scdbackup@gmx.net> - 2016-09-27 17:10 +0200
          Re: Substring search in dash [ _NOT_ bash ] shell Greg Wooledge <wooledg@eeg.ccf.org> - 2016-09-27 17:30 +0200
            Re: Substring search in dash [ _NOT_ bash ] shell "Thomas Schmitt" <scdbackup@gmx.net> - 2016-09-27 18:00 +0200

csiph-web