bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash manual on interactive shell


From: Kerin Millar
Subject: Re: bash manual on interactive shell
Date: Mon, 13 Dec 2021 11:23:12 +0000

On Sun, 12 Dec 2021 23:51:22 -0800
Mallika <mallika.bachan@gmail.com> wrote:

> Hi!
> 
> Thanks for the quick response! And for clearing up what 'option arguments'
> means.
> 
> I'm not sure I understood the last bit, though
> >Something like "with only option arguments" could easily be misunderstood
> as "with one or more option arguments".
> 
> Are you saying that the 'only' could be easily ignored? i.e. "with one or
> more option arguments" is incorrect because it fails to specify that *no*
> non-option arguments may be used?
> Oh! You're saying the language used includes the case of no arguments at
> all, whereas the language I'm proposing may be interpreted as requiring
> option-arguments (which is what I had strugglingly understood it to mean)
> in that case, may I simply suggest:
> "started without any arguments, or with option arguments only"

Just to muddy the waters further, the POSIX Utility Syntax Guidlines [1] 
employs a different terminology. What the bash manual refers to as a 
"non-option argument" is, instead, an "operand". On the other hand, an 
"option-argument" (note the hypen) would be defined as the argument that 
follows an option that expects one. For instance, in the case of `sh -c date`, 
the string, "date", would be an option-argument!

In the absence of a formal definition, the import of any term constitutes a 
form of tribal knowledge. While the GNU glibc manual speaks of "non-option 
arguments" in its Program Argument Syntax Conventions [2], it does, 
unfortunately, lack the formality and rigour of the aformentioned POSIX 
document. Still, one can infer the meaning by also considering its first bullet 
point, not that I would expect anyone reading the bash manual to necessarily 
think of looking there.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
[2] https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html

> 
> It is certainly more words, but unless you already have a solid
> understanding of non-option arguments (commands?) - in which case you're
> only having to perform one negation in your head - I think this
> construction makes it significantly easier to follow along.
> 
> Ultimately, of course, it's up to you. I've made as much of a case for
> re-wording as I could :)

You mentioned being confused by how the and's and or's combine. The wording of 
the bash man page seems marginally less ambiguous in that regard, partly owing 
to its sparse use of the comma.

"An interactive shell is one started without non-option arguments (unless -s is 
specified) and without the -c option whose standard input and error are both 
connected to terminals (as determined by isatty(3)), or one started with the -i 
option."

Although, I would say that the absence of a comma before whose is a grammatical 
error. In any case, I wanted to suggest the use of the word, either. For 
example:-

"An interactive shell is either one started without non-option arguments 
(unless -s is specified) and without the -c option whose standard input and 
error are both connected to terminals (as determined by isatty(3)), or one 
started with the -i option."

I think that the addition of this word might increase the probability of the 
sentence being (correctly) interpreted in the fashion of "an interactive shell 
is either one that fulfils ( criteria A ) or ( criteria B )", keeping in mind 
that the -i option always renders bash interactive.

-- 
Kerin Millar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]