Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Aug 2015 12:41:07 +0100
From:      Arthur Chance <freebsd@qeng-ho.org>
To:        "Steve O'Hara-Smith" <steve@sohara.org>, freebsd-questions@freebsd.org
Cc:        RW <rwmaillists@googlemail.com>
Subject:   Re: Getting value out of "man getopts"
Message-ID:  <55C0A4D3.90000@qeng-ho.org>
In-Reply-To: <20150804120636.6727ccd13713c1c300d1e07e@sohara.org>
References:  <CAPi0psusiWhyuG52jNRMgwShPuj0djMUb=nO6S=qG9V_9xc-RQ@mail.gmail.com> <slrnmrvko7.2ht3.naddy@lorvorc.mips.inka.de> <20150804115120.602f1f87@gumby.homeunix.com> <20150804120636.6727ccd13713c1c300d1e07e@sohara.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04/08/2015 12:06, Steve O'Hara-Smith wrote:
> On Tue, 4 Aug 2015 11:51:20 +0100
> RW via freebsd-questions <freebsd-questions@freebsd.org> wrote:
>
>> On Mon, 3 Aug 2015 20:45:59 +0000 (UTC)
>> Christian Weisgerber wrote:
>>
>>
>>>> Questions:
>>>> 1. Why does "man getopts" not help me with "getopts"?
>>>
>>> Because getopts only exists as a shell built-in, not as a standalone
>>> command.  Maybe you were thinking of getopt(1).
>>
>>
>> $ which  getopts
>> /usr/bin/getopts
>>
>> It is implemented in sh, but it does exist.
>
> 	However /usr/bin/getopts is linked to alias, bg, cd, command, fc,
> fg, hash, jobs, read, type, ulimit, umask, unalias and wait (all
> in /usr/bin).
>

And they're all the sh script

#!/bin/sh
# $FreeBSD: releng/10.1/usr.bin/alias/generic.sh 151635 2005-10-24 
22:32:19Z cperciva $
# This file is in the public domain.
builtin ${0##*/} ${1+"$@"}

I.e. the /usr/bin external versions of sh builtins are simply 
exec(2)-able wrappers on the internal forms. The source is in 
/usr/src/usr.bin/alias if anyone's interested.

-- 
Those who do not learn from computing history are doomed to
GOTO 1



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55C0A4D3.90000>