The bash script snippet
folder="some folder's name"
a="$folder/"*".pdf"
if [ "$a" != "$folder"'/*.pdf' ]
then
echo check
fi
never prints check.
I'd expect it to print check iff there is at least 1 file whose name ends in .pdf in folder $folder.
echo $a and echo "$folder"'/*.pdf' print exactly what I'd expect them to print: The former prints the matched paths iff there is at least 1 *.pdf file in the specified folder and otherwise prints what the latter prints. The latter always prints the name of the specified older concatenated with /*.pdf.
- Why does bash behave like that?
- How do I make it work?