Selecting out of an array

2010-01-25 Thread Jon_R
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 to assign each video a variable name and then I

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-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