Re: manual: clarify -n (noexec) vs interactive shells
Chet Ramey <[email protected]>
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Organization | ITS, Case Western Reserve University |
| Message-ID | <[email protected]> |
On 8/19/26 10:42 AM, Tom Hale wrote: > Bash Version: 5.3 > Patch Level: 15 > Release Status: release > > Documentation inaccuracy in the manual's description of the `-n` > (noexec) option as it applies to interactive shells. > > The bash manual, section 4.3.1 `The Set Builtin`, says: > > -n > Read commands but do not execute them. This may be used to > check a script for syntax errors. This option is ignored by > interactive shells. > > This wording is misleading. In practice: > > * `set -n` at runtime in an interactive shell is ignored, matching > the manual. > * `bash -n` on the command line is honored even when the shell is > interactive: on a tty it prints the interactive prompt but does > not execute any commands. Thanks for the report. Per the August 2024 discussion you reference below, the right thing is to ignore -n when supplied at invocation unless the -i option is also supplied to force an otherwise-non-interactive shell to be interactive. I made that change in 2024, but the code was in the wrong place. I'll fix it. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
(application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE----- wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCaocclAUDAAAAAAAKCRC7WGnwZOp0q4AM AJ41dNxvRNP2R2ng6jirOIA76x94PgCeMjDxy4I2yVSEDm5Yjuec5cVOD7U= =d2iN -----END PGP SIGNATURE-----