Re: weird behaviour of ((count++)) when using , , to change to lower case
On 8/1/10 7:05 PM, Dennis Williamson wrote: > If I do the echo line twice, I get a segfault in both Bash > 4.0.33(1)-release and 4.1.0(1)-release. Thanks. This will be fixed in bash-4.2. > And you're right about being evaluated twice. This was already changed after bash-4.1 was released; the change will be in bash-4.2. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: weird behaviour of ((count++)) when using , , to change to lower case
If I do the echo line twice, I get a segfault in both Bash 4.0.33(1)-release and 4.1.0(1)-release. And you're right about being evaluated twice. On Sun, Aug 1, 2010 at 3:59 PM, Bernd Eggink wrote: > Am 01.08.2010 13:06, schrieb Andrew Benton: > >> Also good. Now try converting it to lower case with ,, >> >> andy:~$ count=0 >> andy:~$ echo "${days[${count}],,}, ${days[$((count++))],,}, >> ${days[$((count++))],,}" >> monday, tuesday, thursday >> >> What happened to wednesday? > > I'd rather expect this to print "monday, monday, tuesday", since you left > out the ++ in the first term. > > I think the problem is that the ,, operator causes each expression to be > evaluated twice. That would explain this behaviour, and it's a bug IMHO. > > Regards, > Bernd > > -- > Bernd Eggink > http://sudrala.de > >
Re: weird behaviour of ((count++)) when using , , to change to lower case
Am 01.08.2010 13:06, schrieb Andrew Benton: Also good. Now try converting it to lower case with ,, andy:~$ count=0 andy:~$ echo "${days[${count}],,}, ${days[$((count++))],,}, ${days[$((count++))],,}" monday, tuesday, thursday What happened to wednesday? I'd rather expect this to print "monday, monday, tuesday", since you left out the ++ in the first term. I think the problem is that the ,, operator causes each expression to be evaluated twice. That would explain this behaviour, and it's a bug IMHO. Regards, Bernd -- Bernd Eggink http://sudrala.de