Sunday, June 30, 2019

Re: cd command, chdir syscall, shell behavour

On 30/06/2019, Edgar Pettijohn <edgar@pettijohn-web.com> wrote:
>>> Then you need to say (...snip; see earlier email...)

Thank you. That contained several useful hints I hadn't even figured
out I could look for there, although this too seems obvious in
retrospect. Maybe I'm not thinking about these things carefully enough
in advance. :)

>> This is perfectly fine, exactly as it should be:
>>
>> schwarze@isnote $ man bash
>> man: No entry for bash in the manual.
>> schwarze@isnote $ pkglocate bin/bash | head -n1
>> bash-5.0.7p0:shells/bash:/usr/local/bin/bash
>>
>> > To end on a positive: Can I add how much I appreciate that OpenBSD
>> > hard-links help(1) to man(1),
>>
>> Heh; deraadt@ did that on Sep 14, 1998 for OpenBSD 2.4 ...
>>
>> > and that man will default to `man help` when called as help?
>>
>> and aaron@ added the help(1) manual page on Oct 18, 1999
>> for OpenBSD 2.6.
>>
>> > This elegant way of having OpenBSD respond to `help` is really
>> > n00b-friendly.
>>
>> And yet, even among those tiny innovations that are somehow neat,
>> not all get picked up elsewhere:
>>
>> https://man.openbsd.org/FreeBSD-12.0/help
>> https://man.openbsd.org/NetBSD-8.0/help
>> https://man.openbsd.org/Linux-5.01/help

In bash, `help` is a shell builtin and does do something, though IMO,
the something that it does isn't initially as helpful as OpenBSD's
help(1), especially to newbies. [1]

However, what it does do, i.e.
* print a list of bash builtins in response to `help`, or
* print bash builtin-specific help in response to `help [builtin]`
could well be helpful later and relates to what we discussed earlier.
Is man(1) plus info(1) plus bash's help some kind of triple
book-keeping or wheel-reinvention? Perhaps, but in terms of
convenience, bash's `help` and `help [builtin]` are stiff competition
to Edgar's earlier hints of `man -k Ic,Nm=[term]` and `man -O
tag=[term]`.
Don't get me wrong; I'm VERY grateful for the hints, and I don't think
I have or know of an ideal solution. All the same, I think this is
still an area where considerable possibility for user confusion yet
abounds.

Ian

footnote:
[1] This also means that if an OpenBSD sysadmin tries to be "helpful
to newbies" by installing the bash they're maybe used to, they will by
default clobber access to OpenBSD's excellent help(1), and it would
take extra care to re-enable that and to then figure out a nice way to
still provide access to bash's builtin help too... aaargh! Maybe bash
on OpenBSD isn't the best choice really.

No comments:

Post a Comment