Jason McIntyre wrote (2022-11-20 21:45 CET):
> On Sun, Nov 20, 2022 at 08:09:13PM +0100, Tomasz Rola wrote:
> > On Sun, Nov 20, 2022 at 01:32:54PM -0000, Christian Weisgerber wrote:
> > > On 2022-11-20, Reuben mac Saoidhea <ancatm...@outlook.com> wrote:
> > > 
> > > >> It is a builtin, so it is documented inside ksh.
> > > >
> > > > i think the 4.3BSD manual allowed for example `man while' for `man sh'?
> > > 
> > > FreeBSD has a builtin(1) man page that attempts to list the csh(1)
> > > and sh(1) builtins and points to the respective man pages:
> > > 
> > > https://www.freebsd.org/cgi/man.cgi?query=builtin
> > > 
> > > It's an attempt to do something about this problem, but I think the
> > > result isn't that great.
> > 
> > I am writing this from ParrotOS (Debian derivative) and since I am
> > avid user of bash, I can do "man bash-builtins" and it prints me a
> > very nice looking summary. Bash package version is 5.1-2+deb11u1,
> > which probably means 5.1 with some Debian-specific addons.
> > 
> 
> the thing is, you have to be aware of a builtins page in order to know
> to type "man builtins" (or whatever). you would need to know that a
> command is a builtin. but if you know it's a builtin, then you can just
> type "man ksh" and get the documentation.
> 
> we could add all these commands to ksh's NAME, but that would look awful.
> 
> i think it's just a case of we should expect people to familiarise
> themselves with the shell they're using, and know to go digging there.
> openbsd does not generally have undocumented commands, so it's all there
> somewhere.

There are 4 things you can type into a shell:
- executables (found along the path)
- functions (defined by yourself [or the distribution])
- aliases (defined by yourself [or the distribution])
- builtins (comes with the shell)

$ type type echo printf dgrep music_ambient ls
type is a shell builtin
echo is a shell builtin
printf is /usr/bin/printf
dgrep is a function
music_ambient is an alias for 'mpg123 http://62.210.114.63:8002/listen.mp3'
ls is a tracked alias for /bin/ls

I think this is better than a manpage. If we provide two manpages, one 
for the builtin echo and one for /bin/echo, then you still don't know 
which one is actually used.

bash:
$ type printf
printf is a shell builtin

ksh:
$ type printf
printf is /usr/bin/printf

Best Regards,
Stefan

Reply via email to