本文介绍了引号内的通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我执行以下操作时:
rmdir /path/to/dir/*.lproj
它工作正常.
当我这样做时:
APP_RESOURCES="/path/to/dir"
rmdir "$APP_RESOURCES/*.lproj"
它不起作用,并说它从字面上查找以astrix符号命名的目录.通配符不会被解释.如何使它在报价范围内起作用?
It doesn't work and says it literally looks for a directory named with an astrix-symbol. The wildcard doesn't get interpreted. How can this be made to work within quotations?
推荐答案
扩展由外壳处理,因此您必须编写如下内容:
Expansion is handled by the shell so you will have to write something like this:
APP_RESOURCES="/path/to/dir"
rmdir "${APP_RESOURCES}/"*.lproj
这篇关于引号内的通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!