bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix coreutils-5.0.91 rejecting "[ toto -eq tata ]" like form


From: Bob Proulx
Subject: Re: [PATCH] fix coreutils-5.0.91 rejecting "[ toto -eq tata ]" like forms
Date: Wed, 7 Jan 2004 23:32:18 -0700
User-agent: Mutt/1.3.28i

Olivier Delhomme wrote:
> As this sounds Good to me, and that i'm a bit curious I
> did the following and a strange thing is that it fails :
> 
> address@hidden:~$ which [
> /usr/bin/[

The 'which' command is non-portable.  Different systems implement it
differently.  On traditional systems it is a /bin/csh script which
loads your $HOME/.cshrc file and can report aliases and also be
confused by them and PATH statements there.  On other systems it is a
shell or bash script.  In neither case does it report shell builtins.
Depending upon your shell you may need any or all of these.  The top
two are probably the best of the bunch.  But none are POSIX standard.

  type [
  command -v [
  type -a [
  whence [
  which [

I suspect type [ for you will say "[ is a shell builtin".  Your use of
it to see that [ is in /usr/bin I believe has confused you into
thinking it is not a shell builtin.  But it is.

> address@hidden:~$ [ --version | head -n1
> -bash: [: missing `]'

This is a bash error effectively saying that [ is a bash builtin.  An
error from /usr/bin/[ is not reported as coming from bash.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]