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

Re: Selecting out of an array

2010-01-26 Thread Marc Herbert
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 "file: $f"; done

Re: Selecting out of an array

2010-01-25 Thread Jan Schampera
Jon_R schrieb: > http://old.nabble.com/file/p27316649/newsh2.sh newsh2.sh You have a misunderstanding about select here, I guess. Select is supposed to display a list of given words and take user input (index to these words). It more or less is the same as a for loop, it just doesn't iterate th

Re: Selecting out of an array

2010-01-25 Thread DennisW
On Jan 25, 7:28 pm, Jon_R wrote: > Hello List, > > I am new to shell scripting and programming in general, so please excuse my > ignorance. :) > > I am trying to setup a menu for some videos that I have so that you can > select one and it will play it using xine or mplayer. My first attempt was >