Here the second variable is not a found directory but a search pattern. How to prevent this behavior ?
mkdir -p mytestdir001
for f in "mytestdir???"; do
echo $f
echo "$f"
done
result:
mytestdir001
mytestdir???
You've misinterpreted the problem. The issue is that you have quoted the wildcards when you shouldn't have.
mkdir -p mytestdir001
for f in "mytestdir"???; do
echo $f
echo "$f"
done