Well apart from not being a fan of using ls to parse data (for reasons outline
here), something I found a little odd with your script is the following:
Code:
touch /home/$USER/"$Collection-$(date +%F)"
echo "${file%.*}" >>$Collection-$(date +%F)
Are these supposed to be 2 completely different files in different places?
Also, in the unusual situation that you run this script around midnight, you could end up with differently named files
with your data split over the 2 of them (just a thought)
Something you might like to look at with your yes / no question (apart from handling incorrectly entered options) is
that you can test for a single response by controlling the format.
Example:
Code:
read ans
case ${ans^^} in # alternative is ,,
YES) <do blah>
^^ convert to all upper case and ,, to convert to all lower case