bug-bash
[Top][All Lists]
Advanced

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

Re: Bash parameter expansion (remove largest trailing match, remove larg


From: Koichi Murase
Subject: Re: Bash parameter expansion (remove largest trailing match, remove largest leading match, pattern replacement) does not work
Date: Sun, 30 Aug 2020 04:27:35 +0900

2020年8月30日(日) 3:55 Bruce Lilly <bruce.lilly@gmail.com>:
> Please don't assume that something output by printf (without
> quoting) for clarity is representative of actual expansion by the
> shell when properly quoted.

Please don't assume that I have assumed something strange.  To begin
with, you didn't provide the script `shellbug', so something needs to
be assumed anyway.  Since it seems you are aware that your original
post would be unclear and confuse others, you could have just included
the contents of the file `shellbug'.  Anyway, I did NOT assume that
you have literally written broken quoting like

  separator2(octal escape)=\057
  pattern1=${number1}(${separator1})

I assumed that you have written like

  separator2='\057'
  pattern1="${number1}(${separator1})"

because otherwise, it doesn't work with ksh93 either.


To explain it in more detail, first, these parameter expansions work
for me with separator1='/'.  The pattern that you constructed from
separator2='\057' is just not supported by Bash.  Next, you specify
exactly the same script `shellbug' to both Bash and ksh93, so I could
assume that you are missing the Bash-specific `shopt -s extglob' in
the script because otherwise, ksh93 would have complained it.  That is
all what I can guess from your original post.

--
Koichi



reply via email to

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