[英]how to prevent bash from returning wildcard when variable is in double quotes?
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.