Re: Brace expansion change on devel

2025-05-16 Thread Chet Ramey
On 5/10/25 11:18 AM, Sam James wrote: Hi, Since the following commit on devel commit c3ca11424d2ae66cafa2f931b008dfb728e209a5 Author: Chet Ramey Date: Wed Feb 12 11:18:16 2025 -0500 fix issue with redirections to bash input file descriptor; new minimal chmod buil

Re: Brace expansion ordering vs. parameter expansion

2021-04-29 Thread Chet Ramey
On 4/29/21 12:59 PM, Tom (AST) Watson wrote: All... I've resigned to having it the way it is, but I note that the solution doesn't need the backslash escape: [tsw@box6 ~]$ k=10 [tsw@box6 ~]$ eval echo {1..$k} 1 2 3 4 5 6 7 8 9 10 This one doesn't, but putting in the slash skips the first brac

RE: Re: Brace expansion ordering vs. parameter expansion

2021-04-29 Thread Tom (AST) Watson
; as they show themselves. Thanks for the input. It has been helpful. ...Tom -Original Message- From: Chet Ramey Sent: Thursday, April 29, 2021 07:46 To: Ilkka Virta Cc: chet.ra...@case.edu; Tom (AST) Watson ; bug-bash@gnu.org Subject: [External] Re: Brace expansion ordering vs. paramete

Re: Brace expansion ordering vs. parameter expansion

2021-04-29 Thread Chet Ramey
On 4/29/21 8:12 AM, Ilkka Virta wrote: Maybe, but it's never worked that way and was never intended to. You can get what you need using eval: eval echo \{1..${i}} BTW, was there some background to why they're ordered like this? I'm not sure if I have heard the story, and didn't s

Re: Brace expansion ordering vs. parameter expansion

2021-04-29 Thread Greg Wooledge
On Thu, Apr 29, 2021 at 03:12:09PM +0300, Ilkka Virta wrote: > BTW, was there some background to why they're ordered like this? I'm not > sure if I have heard the story, and didn't see anything about it in Greg's > wiki or bash-hackers.org (of course they tell the "what", but not the > "why"). I di

Re: Brace expansion fail compilation

2017-04-26 Thread Chet Ramey
On 4/26/17 6:13 AM, Florian Mayer wrote: > - Expansion will be performed like it should be the case, because „{„ is > obviously a parameter expansion terminal character as the line > $ echo $BASH_VERSION{nobraceexpansion} > shows, because this line really does expand $BASH_VERSION This is not a

Re: Brace expansion fail compilation

2017-04-26 Thread Florian Mayer
wow..., ok thanks for the quick reply > On 26 Apr 2017, at 12:17, Pierre Gaston wrote: > > > >> On Wed, Apr 26, 2017 at 1:13 PM, Florian Mayer wrote: >> $ echo $BASH_VERSION >> 4.4.12(1)-release >> $ echo $BASH_VERSION{nobraceexpansion} >> 4.4.12(1)-release{nobraceexpansion} >> $ echo ${BASH_

Re: Brace expansion fail compilation

2017-04-26 Thread Pierre Gaston
On Wed, Apr 26, 2017 at 1:13 PM, Florian Mayer wrote: > $ echo $BASH_VERSION > 4.4.12(1)-release > $ echo $BASH_VERSION{nobraceexpansion} > 4.4.12(1)-release{nobraceexpansion} > $ echo ${BASH_VERSION}{brace,expansion} > 4.4.12(1)-releasebrace 4.4.12(1)-releaseexpansion > $ echo $BASH_VERSION{brac

Re: Brace Expansion doesn't handle whitespace gracefully

2016-08-30 Thread Chet Ramey
On 8/30/16 2:43 PM, Wesley Hirsch wrote: > My guess is that is caused by the fact that initial > wordsplitting separates > the components before brace expansion can get to them, but this is > unintuitive, and either the behavior should change or the > documentation >

Re: brace expansion fails in 4.3, succeed in 4.2

2014-05-10 Thread Dan Douglas
On Saturday, May 10, 2014 11:28:44 PM NBaH wrote: > Do you mind explaining a little bit «the way Bash parses array > subscripts» ? > Didn't notice this reply (as I failed to mention, this is slightly ridiculous code. Use a loop for important code of course). It skips over any text between the clo

Re: brace expansion fails in 4.3, succeed in 4.2

2014-05-10 Thread Dan Douglas
On Saturday, May 10, 2014 03:31:05 PM Dan Douglas wrote: > $ bash -c 'printf -v a "%(%s)T" -1; printf "%(%Y%m%d)T " "$a" "${a[a+=60*60*24,0]"{0..8}"}"; echo' > 20140510 20140511 20140512 20140513 20140514 20140515 20140516 20140517 20140518 20140519 By the way, I'm not very good at remembering

Re: brace expansion fails in 4.3, succeed in 4.2

2014-05-10 Thread NBaH
Le 10/05/2014 22:31, Dan Douglas a écrit : $ bash -c 'printf -v a "%(%s)T" -1; printf "%(%Y%m%d)T " "$a" "${a[a+=60*60*24,0]"{0..8}"}"; echo' 20140510 20140511 20140512 20140513 20140514 20140515 20140516 20140517 20140518 20140519 Thank you very much. This is tremendous! Do you mind explai

Re: brace expansion fails in 4.3, succeed in 4.2

2014-05-10 Thread Dan Douglas
On Saturday, May 10, 2014 02:35:44 PM NBaH wrote: > bash-4.2 $ printf "%s " "$(date -d -"{0..9}"days +%Y%m%d)" 20140510 > 20140509 20140508 20140507 20140506 20140505 20140504 20140503 > 20140502 20140501 > > bash-4.3 $ printf "%s " "$(date -d -"{0..9}"days +%Y%m%d)" date: date > non valide « -{0..

Re: Brace expansion infinite loop, memory corruption, and other bugs.

2012-06-22 Thread Chet Ramey
> On 6/5/12 12:14 AM, Scott McMillan wrote: > > A week or so ago I submitted a bug report using the bashbug command > > that involved some > > overflow issues with braces.c on OpenSUSE12.1 X86_64. Browsing the > > patches, I got > > the impression that braces.c hasn't been modified since the origin

Re: Brace expansion infinite loop, memory corruption, and other bugs.

2012-06-05 Thread Chet Ramey
On 6/5/12 12:14 AM, Scott McMillan wrote: > A week or so ago I submitted a bug report using the bashbug command > that involved some > overflow issues with braces.c on OpenSUSE12.1 X86_64. Browsing the > patches, I got > the impression that braces.c hasn't been modified since the original > 4.2 rel

Re: Brace expansion bug

2012-03-27 Thread Chet Ramey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 3/26/12 6:32 AM, Dan Douglas wrote: > Hi, hopefully a self-explanatory one today: > > ~ $ ( set -x -- {a..c}; echo "${*-"{1..3}"}" ) > + echo 'a b c' 'a b c' 'a b c' > a b c a b c a b c > > ~ $ ( set -x -- {a..c}; echo "${*/"{1..3}

Re: Brace expansion bug

2012-03-26 Thread Dan Douglas
On Monday, March 26, 2012 08:07:00 AM you wrote: > On 03/26/2012 07:56 AM, Dan Douglas wrote: > > Don't know how much I'm allowed to quote here, but a quick read of the > > POSIX parsing rules and parameter expansion sections suggest to me that > > the start of the parameter expansion should be th

Re: Brace expansion bug

2012-03-26 Thread Eric Blake
On 03/26/2012 07:56 AM, Dan Douglas wrote: > Don't know how much I'm allowed to quote here, but a quick read of the POSIX > parsing rules and parameter expansion sections suggest to me that the start > of the parameter expansion should be the most important factor, and that > nested quotes and

Re: Brace expansion bug

2012-03-26 Thread Dan Douglas
On Monday, March 26, 2012 01:44:58 PM you wrote: > Dan Douglas writes: > > Hi, hopefully a self-explanatory one today: > > ~ $ ( set -x -- {a..c}; echo "${*-"{1..3}"}" ) > > + echo 'a b c' 'a b c' 'a b c' > > a b c a b c a b c > > > > ~ $ ( set -x -- {a..c}; echo "${*/"{1..3}"

Re: Brace expansion bug

2012-03-26 Thread Andreas Schwab
Dan Douglas writes: > Hi, hopefully a self-explanatory one today: > > ~ $ ( set -x -- {a..c}; echo "${*-"{1..3}"}" ) > + echo 'a b c' 'a b c' 'a b c' > a b c a b c a b c > > ~ $ ( set -x -- {a..c}; echo "${*/"{1..3}"/$*}" ) > + echo 'a b c' 'a b c' 'a b c' > a b c a b c a

Re: Brace expansion padding inconsistencies

2011-08-10 Thread Chet Ramey
On 8/10/11 4:43 PM, gregry . wrote: > bash> echo {0..9..2} > 0 2 4 6 8 > bash> echo {00..9..2} > 00 02 04 06 08 > bash> echo {0..09..2} > 0 2 4 6 8 > bash> echo {00..09..2} > 0 2 4 6 8 > > The first two are as expected, but the last two have unexpected addi

Re: Brace expansion inside of command substitution - broken or is it me?

2011-02-19 Thread Chet Ramey
On 2/19/11 6:13 AM, Peter Hofmann wrote: > Aha, I see. I've read that part about "strictly textual" and "performed > before all other expansions" in the manual, but I didn't realize all the > consequences. This means that my quotes get interpreted *after* the > brace expansion is done, right? We

Re: Brace expansion inside of command substitution - broken or is it me?

2011-02-19 Thread Peter Hofmann
Hi, On Fri, Feb 18, 2011 at 07:26:18PM -0500, Chet Ramey wrote: > Brace expansion is strictly textual, is performed before all other > expansions, and doesn't understand a whole lot of shell syntax. > It does understand a little about quoted strings, so what you get is > > echo "$(echo "1")" "$(e

Re: Brace expansion inside of command substitution - broken or is it me?

2011-02-18 Thread Chet Ramey
On 2/18/11 4:32 PM, Peter Hofmann wrote: > So far, so good. It's what I expected. Let's add another level of > quotes: > > $ echo "$(echo "{1..3}")" > 1 2 3 > > Huh? Actually, I was expecting to get the same output as before. > > Some debug output: > > $ set -x > $ echo "$(echo "{1..3}")"

Re: Brace expansion inside of command substitution - broken or is it me?

2011-02-18 Thread Greg Wooledge
On Fri, Feb 18, 2011 at 10:53:31PM +0100, Andreas Schwab wrote: > Greg Wooledge writes: > > > On Fri, Feb 18, 2011 at 10:32:13PM +0100, Peter Hofmann wrote: > >> > >> $ echo "$(echo "{1..3}")" > >> 1 2 3 > >> > >> Huh? > > > > Brace expansion is a funny thing. My belief at the moment -- I'm

Re: Brace expansion inside of command substitution - broken or is it me?

2011-02-18 Thread Andreas Schwab
Greg Wooledge writes: > On Fri, Feb 18, 2011 at 10:32:13PM +0100, Peter Hofmann wrote: >> >> $ echo "$(echo "{1..3}")" >> 1 2 3 >> >> Huh? > > Brace expansion is a funny thing. My belief at the moment -- I'm sure > someone will correct me if I'm wrong -- is that because you've got > everythi

Re: Brace expansion inside of command substitution - broken or is it me?

2011-02-18 Thread Greg Wooledge
On Fri, Feb 18, 2011 at 10:32:13PM +0100, Peter Hofmann wrote: > > $ echo "$(echo "{1..3}")" > 1 2 3 > > Huh? Brace expansion is a funny thing. My belief at the moment -- I'm sure someone will correct me if I'm wrong -- is that because you've got everything quoted up, it's all seen as one "wo

Re: Brace expansion

2009-04-06 Thread Chet Ramey
> So... what gives??? I tried looking at info coreutils 'printf > invocation', and it does not even explicitly spell out what the %d > argument means, instead it just tells me "it's like the C printf, except > for these differences". I have never used C, and have no idea where to > look it up,

Re: Brace expansion

2009-04-05 Thread Jan Schampera
Ray Parrish wrote: > bash: printf: 08: invalid number > 0 > bash: printf: 09: invalid number Arithmetic expression/base specifications: http://bash-hackers.org/wiki/doku.php/syntax/arith_expr#different_bases Seems to apply for all numerical formats for printf, too. J.

Re: Brace expansion

2009-04-04 Thread Chris F.A. Johnson
On Sat, 4 Apr 2009, Ray Parrish wrote: I'm attempting to study Brace Expansion at the same named page at bash-hackers.org and it states the following - Generate numbers with a prefix 001 002 ... Using a prefix: for i in 0{1..9} 10; do printf "%d\n" "$i";done However I am getting *this* outpu