I have the following as part of a longer script:
# Find & list out files
filefind (){
files=( */*.md )
PS3="$MSG" ;
select file in "${files[@]}"; do
if [[ $REPLY == "0" ]]; then echo 'Bye!' >&2 ; exit
elif [[ -z $file ]]; then echo 'Invalid choice, try again' >&2
else break
fi
done ;}
I would like to echo " No Files found. Enter 0 to exit" if the folder is empty. I realise I would need another elif line to do this.
When I run this, as is, I always get a return of:
{ ~/Code/newblog } $ ./blog pp
1) /.md
Choose file to Publish, or 0 to exit:
Ideally I'd like only the message with exit option, but would also like to understand why the /.md is returned. Apologies if this is answered elsewhere, hard to know what to look for if you don't know what to look for..! Happy to be pointed in the right direction.
0 comments:
Post a Comment
Thanks