Date: Wed, 25 Oct 2017 16:27:18 +0200 From: Polytropon <freebsd@edvax.de> To: zep <zgreenfelder@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: A request to segregate man pages for shell built-ins Message-ID: <20171025162718.ccb5752f.freebsd@edvax.de> In-Reply-To: <590388f5-6c80-fe60-1370-a071ffef5649@gmail.com> References: <VI1PR02MB1200817E0E2CDD2A2A42E1A5F6440@VI1PR02MB1200.eurprd02.prod.outlook.com> <f88cd63e-3cbc-4463-5219-99d204742b85@FreeBSD.org> <15f52853ee8.2787.c09309b3b9b6c7ba483efefa0c51d672@rail.eu.org> <VI1PR02MB12005A16022101E37C9C4D00F6440@VI1PR02MB1200.eurprd02.prod.outlook.com> <20171025152240.b83f20e5.freebsd@edvax.de> <590388f5-6c80-fe60-1370-a071ffef5649@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 25 Oct 2017 10:10:05 -0400, zep wrote: > On 10/25/2017 09:22 AM, Polytropon wrote: > > On Wed, 25 Oct 2017 08:03:03 +0000, Manish Jain wrote: > >> > >> On 10/25/17 13:23, Erwan DAVID wrote: > >>> That would mean doing a new section per shell eg (1bash) (1csh) (1zsh) > >>> each shell has its own builtins, Hicham can differ (compare set in bash > >>> and csh ) > >> Perhaps a new, unique section of man pages (something like section 99) > >> implemented for sh only and which can be called by any shell with the > >> same syntax : 'man 99 set' > > Or like pkg's "sub-manpages", with a hyphen: > > > > % man echo-csh > > > > compared to > > > > % man test-bash > > > > And for "identical implementations", compound manuals just as if > > you'd use "man 3 malloc" or "man 3 calloc" to take you to the same > > manual page. > > > > you could also build a 'smarter' man in such a case - e.g. as a shell > script wrapper kinda thing, it could do a which first, find out if the > shell you're currently running it from has a builtin, if there's a > binary, then chose the right one for how it's called and possibly > include a caveat about other versions. This is possible, but there is the following obstacle: A shell can invoke an external command or a builtin depending on execution context, i. e., if the shell is currently processing a shell script, the builtin will be used, but if it runs an interactive session, the external command will be called. I cannot remember what shell it was, but I encountered this strange behaviour once, many years ago: Something that worked at the command line didn't work the same way when used inside a shell script, even though the text was used 1:1. It was on some expensive UNIX nobody remembers anymore... ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171025162718.ccb5752f.freebsd>