From owner-freebsd-questions@freebsd.org Tue Aug 4 11:41:18 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B82099B3614 for ; Tue, 4 Aug 2015 11:41:18 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from bede.qeng-ho.org (bede.qeng-ho.org [217.155.128.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "fileserver.home.qeng-ho.org", Issuer "fileserver.home.qeng-ho.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A721981 for ; Tue, 4 Aug 2015 11:41:18 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from arthur.home.qeng-ho.org (arthur.home.qeng-ho.org [172.23.1.2]) by bede.home.qeng-ho.org (8.14.9/8.14.9) with ESMTP id t74Bf7TF034219; Tue, 4 Aug 2015 12:41:07 +0100 (BST) (envelope-from freebsd@qeng-ho.org) Subject: Re: Getting value out of "man getopts" To: "Steve O'Hara-Smith" , freebsd-questions@freebsd.org References: <20150804115120.602f1f87@gumby.homeunix.com> <20150804120636.6727ccd13713c1c300d1e07e@sohara.org> Cc: RW From: Arthur Chance Message-ID: <55C0A4D3.90000@qeng-ho.org> Date: Tue, 4 Aug 2015 12:41:07 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20150804120636.6727ccd13713c1c300d1e07e@sohara.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2015 11:41:18 -0000 On 04/08/2015 12:06, Steve O'Hara-Smith wrote: > On Tue, 4 Aug 2015 11:51:20 +0100 > RW via freebsd-questions 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