今天遇上一个忧桑的问题。配置完编译环境,发现shell脚本或者终端中无法识别通配符”*“,使用时提示如下错误信息:
cannot access *: No such file or directory
如下为我使用的解决办法 ,记录下希望帮助到需要的人:
1、查看nullglob配置
运行shopt命令,查看nullglob选型的配置,命令如下:
shopt
shopt的使用说明可以查阅如下页面的介绍:
http://man.linuxde.net/shopt,如下为我不可用时的配置:
autocd off
cdable_vars off
cdspell off
checkhash off
checkjobs off
checkwinsize on
cmdhist on
compat31 off
compat32 off
compat40 off
compat41 off
compat42 off
complete_fullquote on
direxpand off
dirspell off
dotglob off
execfail off
expand_aliases on
extdebug off
extglob on
extquote on
failglob off
force_fignore on
globstar off
globasciiranges off
gnu_errfmt off
histappend on
histreedit off
histverify off
hostcomplete off
huponexit off
interactive_comments on
lastpipe off
lithist off
login_shell on
mailwarn off
no_empty_cmd_completion off
nocaseglob off
nocasematch off
nullglob on
progcomp on
promptvars on
restricted_shell off
shift_verbose off
sourcepath on
xpg_echo off
可以看到nullglob选型当前时off状态。
2、激活nullglob选型
使用如下命令激活nullglob选型。
shopt -s nullglob
之后再去试试吧。