Re: Selecting out of an array

2010-01-27 Thread Jon_R
Marc Herbert-5 wrote: > > DennisW a écrit : >> Also, don't use ls like this - it's eyes-only. > > Here is a demonstration: > > touch "filename with spaces" > ARRAY=( $(ls) ) # BUG > for f in "${arr...@]}"; do echo "file: $f"; done > ARRAY=( * ) # OK > for f in "${arr...@]}"; do echo "f

Re: Selecting out of an array

2010-01-27 Thread Jon_R
It's not necessary to print the array, select will do that for you. The way you're using select makes it only have access to one value which is the last one in the array because the "for index" loop leaves index pointing to the last array element. Also, don't use ls like this - it's eyes-only. Tr

left bit shift (<<) operator now demands line continuation

2010-01-27 Thread jwm
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKA

Re: variable assignment in string returning function

2010-01-27 Thread DennisW
On Jan 27, 10:54 am, "Chris F.A. Johnson" wrote: > On Wed, 27 Jan 2010, Sharuzzaman Ahmat Raslan wrote: > > I found the behaviour of the function below is a little bit odd. Appreciate > > if someone can share his/her knowledge regarding the behaviour. > > > The output of the script will be: > > >

Re: variable assignment in string returning function

2010-01-27 Thread Chris F.A. Johnson
On Wed, 27 Jan 2010, Sharuzzaman Ahmat Raslan wrote: > I found the behaviour of the function below is a little bit odd. Appreciate > if someone can share his/her knowledge regarding the behaviour. > > The output of the script will be: > > sharuzza...@debian:~$ ./case1.sh > Nice behaviour, > > S

Re: variable assignment in string returning function

2010-01-27 Thread Mart Frauenlob
On 27.01.2010 13:49, Sharuzzaman Ahmat Raslan wrote: > Hi, > > I found the behaviour of the function below is a little bit odd. Appreciate > if someone can share his/her knowledge regarding the behaviour. > > The output of the script will be: > > sharuzza...@debian:~$ ./case1.sh > Nice behaviour

Re: variable assignment in string returning function

2010-01-27 Thread Greg Wooledge
On Wed, Jan 27, 2010 at 03:07:40PM +0200, Pierre Gaston wrote: > On Wed, Jan 27, 2010 at 2:49 PM, Sharuzzaman Ahmat Raslan > wrote: > > Somehow, the backtick for foo() execute the function, echoing the correct > > output, but fails to set the variable $gang to the correct value. Because of > > tha

Re: variable assignment in string returning function

2010-01-27 Thread Marc Herbert
Sharuzzaman Ahmat Raslan a écrit : > > Somehow, the backtick for foo() execute the function, echoing the correct > output, but fails to set the variable $gang to the correct value. The variable is set, but in a different sub shell. backticks fork a sub shell. By the way $( ) is preferred to back

Re: variable assignment in string returning function

2010-01-27 Thread Pierre Gaston
On Wed, Jan 27, 2010 at 2:49 PM, Sharuzzaman Ahmat Raslan wrote: > Hi, > > I found the behaviour of the function below is a little bit odd. Appreciate > if someone can share his/her knowledge regarding the behaviour. > > The output of the script will be: > > sharuzza...@debian:~$ ./case1.sh > Nice

variable assignment in string returning function

2010-01-27 Thread Sharuzzaman Ahmat Raslan
Hi, I found the behaviour of the function below is a little bit odd. Appreciate if someone can share his/her knowledge regarding the behaviour. The output of the script will be: sharuzza...@debian:~$ ./case1.sh Nice behaviour, Somehow, the backtick for foo() execute the function, echoing the co