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


Groups > gnu.bash.bug > #11309

Re: Worth mentioning in documentation

Path csiph.com!goblin2!goblin.stu.neva.ru!weretis.net!feeder4.news.weretis.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.tele.dk!news.tele.dk!small.news.tele.dk!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Worth mentioning in documentation
Date Mon, 10 Aug 2015 08:19:25 -0400
Lines 27
Approved bug-bash@gnu.org
Message-ID <mailman.8068.1439209202.904.bug-bash@gnu.org> (permalink)
References <3156909.AJj7susDjE@debxuan> <2473887.nPWqTkAiyd@debxuan> <20150807122454.GU4309@eeg.ccf.org> <3273328.haPDicsXFC@debxuan>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1439209202 3245 208.118.235.17 (10 Aug 2015 12:20:02 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bug-bash@gnu.org" <bug-bash@gnu.org>
To Juanma <juan-manuel.menendez@tecsidel.es>
Envelope-to bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <3273328.haPDicsXFC@debxuan>
User-Agent Mutt/1.4.2.3i
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.14
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:11309

Show key headers only | View raw


On Mon, Aug 10, 2015 at 10:18:52AM +0200, Juanma wrote:
> > [ is an ordinary command (a "shell builtin")
> 
> Here is another point I find confusing: I thought a "shell builtin" didn't
> have a separate binary executable file, like 'cd' (which cd => fail), but
> some of them do have such form (which [ => /usr/bin/[ ; which pwd =>
> /bin/pwd). I also fail to see how 'test' modifies the state of the shell
> itself (like 'cd' does), or why it is "impossible or inconvenient to obtain
> [its functionality] with separate utilities".

Don't use which(1).  Which is an external program, so it has no knowledge
of the shell's builtins, aliases, functions and keywords.  Instead, use
type.

imadev:~$ type cd
cd is a shell builtin
imadev:~$ type [[
[[ is a shell keyword
imadev:~$ type -a test
test is a shell builtin
test is /usr/bin/test
test is /bin/test

Bash implements test as a builtin not because it's necessary, but simply
for efficiency.  Forking a whole process to test whether two strings are
equal would be horribly wasteful.

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


Thread

Re: Worth mentioning in documentation Greg Wooledge <wooledg@eeg.ccf.org> - 2015-08-10 08:19 -0400

csiph-web