Re: bash --pretty-print and pattern

2025-02-21 Thread Timotei Campian
great hint! many thanks On Thu, 20 Feb 2025 at 14:26, Koichi Murase wrote: > 2025年2月20日(木) 20:51 Timotei Campian : > > 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 "shop

Re: bash --pretty-print and pattern

2025-02-21 Thread Chet Ramey
On 2/20/25 11:04 AM, Koichi Murase wrote: Thank you. I didn't know this behavior. Is that documented? I tried to find it in the description of `--pretty-print', but I realized that the --pretty-print option itself is undocumented. It's not. It's just a novelty. -- ``The lyf so short, the cr

Re: bash --pretty-print and pattern

2025-02-20 Thread Koichi Murase
2025年2月20日(木) 23:37 Chet Ramey : > > $ bash --pretty-print -O extglob test.sh > > You can use BASH_ENV for this. The primary reason that pretty-printing mode > doesn't suppress execution until after any startup files are read is to > allow a custom startup file to set the shell options you want for

Re: bash --pretty-print and pattern

2025-02-20 Thread Chet Ramey
On 2/20/25 7:25 AM, Koichi Murase wrote: 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

Re: bash --pretty-print and pattern

2025-02-20 Thread Andreas Kähäri
Je Thu, Feb 20, 2025 at 08:29:19AM -0500, Greg Wooledge skribis: > On Thu, Feb 20, 2025 at 21:25:45 +0900, Koichi Murase wrote: > > $ bash --pretty-print -O extglob test.sh > > Yeah, I misread the question a little bit. Sorry about that. > > By the way, is this considered a bug: > > > hobbit:~

Re: bash --pretty-print and pattern

2025-02-20 Thread Greg Wooledge
On Thu, Feb 20, 2025 at 21:25:45 +0900, Koichi Murase wrote: > $ bash --pretty-print -O extglob test.sh Yeah, I misread the question a little bit. Sorry about that. By the way, is this considered a bug: hobbit:~$ bash -O extglob --pretty-print x bash: --: invalid option Usage: bash [GNU long

Re: bash --pretty-print and pattern

2025-02-20 Thread Koichi Murase
2025年2月20日(木) 20:51 Timotei Campian : > 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 scr

Re: bash --pretty-print and pattern

2025-02-20 Thread Greg Wooledge
On Thu, Feb 20, 2025 at 13:50:29 +0200, Timotei Campian wrote: > *OS*=debian12 > *BASH_VERSION*="5.2.15(1)-release" > > the script test.sh has the following content: > > echo !(file.f*) > > > Now calling bash pretty-print result in this error: > > *bash --pretty-print test.sh* > > file1: lin