hi guys i have a question:
i am creating an interactive programme and i need some help on the READ command. let's say that i use the echo command and ask something to my user in the form:
echo 'Please, insert filenames: \c'
then i read his/her answer with:
read answer
i need to test the answer given to see, for example, if the user has really chosen files and not directories for example so i use:
if [[ -d $answer ]]; then
echo 'Attention: you have selected a directory!'
fi
now my problem is this: if the user, instead of just one file, writes 2 or more files?
i know i can write:
read answer1 answer2 etc.
but then it becomes too difficult to check all variables in the IF STATEMENT...and also...what if the user uses more variables than those i have specified? too complicated...
any suggestion on how to include all the possible filenames the user could specify in just one variable to check? (a bit like $@ instead of "$1" "$2" etc.)
hope my question is clear...
thanks.