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/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to