I'm using this as script in Mac automator to do something according to file extension :
if [[ $f =~ .*\.(pdf|doc|docx|rtf) ]]
then ........
BUT if there is pdf or doc or docx or rtf anywhere in file name, not only as extension after dot (.), it's works ?!? it's getting TRUE and going to "then" to execute whatever I wrote there... file with name "my txt file.ddd" is TRUE for this question!
Why is it happen ???
When I run this script in some online bash shell and doing f="my txt file.ddd" it's getting FALSE, as I expect.
What am I doing wrong ? What
if [[ $f =~ .*\.(pdf|doc|docx|rtf) ]]
then ........
is actually doing ? WHERE IS IF SEARCHING FOR MY STRING Thanks.