Code:
watchVideo() {
PS3=">>> Type the video # & hit Enter: "
select video in $(ls $HOME/vids/*.mpg) # Bash select.
do
exec smplayer $video
break # Break, otherwise endless loop.
done
exit 0
}
While displaying the directory contents, I'd like to add the option of going back to the script's main menu, hello(), preferably by pressing 0 (zero) since the contents are numbered starting at 1.
I tried:
Code:
select video in $(ls *.mpg) # Bash select.
do
if [ $video=0 ]; then
hello
else
exec smplayer $video
break # Break, otherwise endless loop.
fi
done
exit 0
which gives this error:
Code:
syntax error near unexpected token `else'
How could this be done? Also, idk how to display directory contents the way 'select' does (letting you choose a file by number) without using 'select', so any pointers to info on that is most welcome. Thanks for your time.