bug-bash@gnu.org

2021-08-23 Thread Chet Ramey
On 8/22/21 5:11 PM, Emanuele Torre wrote: > It would be nice to have a parameter transformation (e.g. "${par@p}") > that expands $par to a string that will not be expanded by PS1, PS2, &c. So you want it to be expanded at some point, but its value not subject to any of the prompt string expansions

efficient way to use matched string in variable substitution

2021-08-23 Thread L A Walsh
Starting with a number N, is there an easy way to print its digits into an array? I came up with a few ways, but thought this would be nice (with '\1' or '$1' being what was matched in the 1st part), this could be statement: arr=(${N//[0-9]/\1 }) or arr=(${N//[0-9]/$1 }) Instead of using loops

Re: efficient way to use matched string in variable substitution

2021-08-23 Thread Greg Wooledge
On Mon, Aug 23, 2021 at 11:36:52AM -0700, L A Walsh wrote: > Starting with a number N, is there > an easy way to print its digits into an array? "Easy"? Or "efficient"? Your subject header says one, but your body says the other. > arr=(${N//[0-9]/\1 }) > arr=(${N//[0-9]/$1 }) Obviously those

Re: efficient way to use matched string in variable substitution

2021-08-23 Thread Oğuz
23 Ağustos 2021 Pazartesi tarihinde L A Walsh yazdı: > Starting with a number N, is there > an easy way to print its digits into an array? > I came up with a few ways, but thought this > would be nice (with '\1' or '$1' being what was matched > in the 1st part), this could be statement: If memo

Re: efficient way to use matched string in variable substitution

2021-08-23 Thread Chet Ramey
On 8/23/21 3:13 PM, Oğuz wrote: > 23 Ağustos 2021 Pazartesi tarihinde L A Walsh yazdı: > >> Starting with a number N, is there >> an easy way to print its digits into an array? >> I came up with a few ways, but thought this >> would be nice (with '\1' or '$1' being what was matched >> in the 1st

Re: efficient way to use matched string in variable substitution

2021-08-23 Thread L A Walsh
On 2021/08/23 12:10, Greg Wooledge wrote: On Mon, Aug 23, 2021 at 11:36:52AM -0700, L A Walsh wrote: Starting with a number N, is there an easy way to print its digits into an array? "Easy"? Or "efficient"? Your subject header says one, but your body says the other. Efficient,

Re: efficient way to use matched string in variable substitution

2021-08-23 Thread Greg Wooledge
On Mon, Aug 23, 2021 at 12:41:58PM -0700, L A Walsh wrote: > > > On 2021/08/23 12:10, Greg Wooledge wrote: > > On Mon, Aug 23, 2021 at 11:36:52AM -0700, L A Walsh wrote: > > > Starting with a number N, is there > > > an easy way to print its digits into an array? > > > > "Easy"? Or "efficient"?