我刚刚在这里发现了bash extglob shell选项:- How can I use inverse or negative wildcards when pattern matching in a unix/linux shell?
所有使用shopt -s extglob的答案都提到了shopt -u extglob来关闭它。为什么我要关掉这么有用的东西呢?实际上,为什么它不是默认开启的呢?据推测,它可能会给人带来一些令人不快的惊喜。他们是什么?
发布于 2013-06-19 22:37:51
作为Kornshell的一员,我在.bashrc中默认启用了extglob,因为Kornshell就是这样的,而且我经常使用它。
例如:
$ find !(target) -name "*.xml"在Kornshell中,这不是问题。在BASH中,我需要设置extglob。我还设置了lithist和set -o vi。这允许我在使用shell历史记录时使用VI命令,当我点击v时,它会将我的代码显示为一堆行。
未设置lithist:
for i in *;do;echo "I see $i";done设置了listhist后:
for i in *
do
echo "I see $i"
done现在,只要BASH有print语句,我就万事大吉了。
https://stackoverflow.com/questions/17191622
复制相似问题