Sunday, June 30, 2019

Re: cd command, chdir syscall, shell behavour

Hi Ian,

ropers wrote on Sun, Jun 30, 2019 at 02:18:56PM +0200:

> 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]

Yes. When a user types "help", it is unlikely they are confused
only about shell builtins (or even about the shell at large), but
it sounds more like they need getting started with the OS as a
whole.

> 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?

More like quadruple because there is also the usage message.

But yes, that having a one- or two-line usage message on the one
hand and a complete and concise manual page on the other hand, and
no third copy of the same, is the current official OpenBSD position
because the information isn't really that hard to find in the manual
page, and a third copy would cause additional maintenance effort
and risk getting outdated.

All the same, developers occasionally discuss whether exceptions
of having -h or --help options for a few unusually complicated
programs might make sense (for example right now on tech@), but so
far, it was usually rejected.

> Perhaps, but in terms of convenience, bash's `help` and `help [builtin]`
> are stiff competition to [...] `man -k Ic,Nm=[term]` and `man -O
> tag=[term]`.

Except that features like `help` and `help [builtin]` work differently
for each and every program, so you can't really get used to them,
neither to how to call them nor to which usually incomplete selection
of information they might throw at you, whereas semantic tags work
in a general and uniform way, and not only for .Ic, which is just
one of many examples.

> 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.

Indeed, in particular not as a login shell.

On the other hand, if a user explicitly types "bash", they get what
they ask for, and there is nothing wrong with that.

Yours,
Ingo

No comments:

Post a Comment