【环境配置】ubuntu中shell命令不能识别通配符的解决办法之一

今天遇上一个忧桑的问题。配置完编译环境,发现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
之后再去试试吧。

相关文章

文章浏览阅读2.3k次,点赞4次,收藏22次。最近安装了CARLA预...
文章浏览阅读6.3k次,点赞5次,收藏15次。在清华镜像中下载U...
文章浏览阅读5k次。linux环境, python3.7.问题描述: 安装...
文章浏览阅读4.2k次,点赞4次,收藏17次。要安装这个 standa...
文章浏览阅读894次,点赞51次,收藏31次。在安卓使用vscode主...