bug-bash
[Top][All Lists]
Advanced

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

Re: bash --pretty-print and pattern


From: Koichi Murase
Subject: Re: bash --pretty-print and pattern
Date: Thu, 20 Feb 2025 21:25:45 +0900

2025年2月20日(木) 20:51 Timotei Campian <timoteicampian@gmail.com>:
> echo !(file.f*)
>
>  *bash --pretty-print test.sh*

If this script file "test.sh" will be used as an independent
executable file, to make it work, you need to put "shopt -s extglob"
at the beginning of the file as Greg explained in the other reply. If
the script file is supposed to be sourced by another file where
"extglob" is enabled, you don't have to set "shopt -s extglob" again
at the beginning of the file.

However, even if you make sure that "extglob" is enabled when the
script file is parsed in real situations as described above,
"--pretty-print" still doesn't work because it doesn't execute the
file at all. To parse and print a file with the actual set of shell
options that the file is supposed to be parsed, you need to set them
in the command-line options of Bash. In the present case, you can run
it in the following way:

$ bash --pretty-print -O extglob test.sh

--
Koichi



reply via email to

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