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


Groups > gnu.bash.bug > #14813

Re: built-in '[' and '/usr/bin/[' yield different results

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: built-in '[' and '/usr/bin/[' yield different results
Date Tue, 13 Nov 2018 12:54:31 -0500
Lines 27
Approved bug-bash@gnu.org
Message-ID <mailman.3985.1542131699.1284.bug-bash@gnu.org> (permalink)
References <5b86cf1c-d39a-befc-9734-5be8abd5cddd@heinzerling.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding 8bit
X-Trace usenet.stanford.edu 1542131700 11872 208.118.235.17 (13 Nov 2018 17:55:00 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org, bash@packages.debian.org
To Service <service@heinzerling.com>
Envelope-to bug-bash@gnu.org
Mail-Followup-To Service <service@heinzerling.com>, bug-bash@gnu.org, bash@packages.debian.org
Content-Disposition inline
In-Reply-To <5b86cf1c-d39a-befc-9734-5be8abd5cddd@heinzerling.com>
User-Agent NeoMutt/20170113 (1.7.2)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 139.137.100.1
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14813

Show key headers only | View raw


On Tue, Nov 13, 2018 at 05:29:42PM +0100, Service wrote:
> Repeat-By:
>     Under Windows 10, WSL.

Then why did you send this to a debian.org address?

>     Start "bash", terminal with shell pops up.

>     2. This does not work:
> 
>     # Put the above commands into a script, say check.sh
>     # Run with: /bin/sh < check.sh
>     # Or      : /bin/sh ./check.sh

In both of these cases, you're explicitly calling /bin/sh rather than
bash.  So you are not using bash's builtin [.  You are using WSL's sh's
builtin [ command.  You might start by identifying which shell WSL uses
as its sh.

>     # Or      : /usr/bin/env ./check.sh

In this case, it would use the shebang line of check.sh to decide which
shell to run.  However, I suspect you did not include a shebang line at
all.  In that case, /usr/bin/env will decide how to handle the exec
format error.  It might decide to spawn sh for you, in which case this
would explain why the result matches the first two results.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: built-in '[' and '/usr/bin/[' yield different results Greg Wooledge <wooledg@eeg.ccf.org> - 2018-11-13 12:54 -0500

csiph-web