I made a short script to help me learn bash. The function in question is:
# Create alphabetical array of video files by recursively scanning $HOME.
video=$(find $HOME/* -name *.flv |sort; find $HOME/* -name *.mpg |sort; find $HOME/* -name *.avi |sort)
PS3=">>> Choose; hit Enter. > "
echo " 0) Return to Main Menu."
# Display all video files.
select choice2 in $video
if [ $choice2 ==0 ]; then
hello # If $USER chooses 0, return to Main Menu.
exec mplayer $choice2
I just want 1 command for the video
variable: find's -name parameter accepting a list of filenames prefaced with * instead of the same command 3 times. I've tried
find $HOME/* -name [*.mpg,*.flv,*.avi] | sort
variations, but to no avail. How can this be done? BTW, this is on Ubuntu 8.10.
Update: I tried "find -name $HOME/*/[*.mpg, *.flv, *.avi] | sort" which gave:
find: warning: Unix filenames usually don't contain slashes (though pathnames do). That means that '-name `/home/agrestic/*/[*.mpg,'' will probably evaluate to false all the time on this system. You might find the '-wholename' test more useful, or perhaps '-samefile'.
And "find -wholename $HOME/*/[*.mpg, *.flv, *.avi] | sort" which gives:
find: paths must precede expression: *.flv,
So still no clue.