zsh: no matches found: 错误解决 setopt no_nomatch
文章目录
- Intro
- 解决方式
- 当前shell修改配置
- 配置永久生效
- WHY
- no_match 选项
Intro
我在zsh上执行一些命令(我在使用JDK自带的wsimport
从WSDL生成Java客户端代码)的时候,遇到一些问题。
命令内容及功能不重要,问题的原因都是因为shell兼容性的相关配置
。
以下为命令执行内容:
wsimport http://www.wuyujin.com:8000/webservice-server-java/index?wsdl
zsh: no matches found: http://www.wuyujin.com:8000/webservice-server-java/index?wsdl
leung@wuyujin wsimmportoutput %
leung@wuyujin wsimmportoutput % setopt no_nomatch
leung@wuyujin wsimmportoutput %
leung@wuyujin wsimmportoutput % wsimport http://www.wuyujin.com:8000/webservice-server-java/index?wsdl
正在解析 WSDL...
正在生成代码...
正在编译代码...
leung@wuyujin wsimmportoutput %
现象是同样的命令,只有在zsh
才会出现,而使用bash
与sh
执行时,没有问题。
解决方式
当前shell修改配置
对当前zsh
执行一次setopt no_nomatch
(效果见上图)
配置永久生效
该设置可以被写入当前用户的zsh配置文件,以便永久生效。
vi ~/.zshrc
编辑,新增要执行的配置行即可
setopt no_nomatch
重新执行该配置脚本
source ~/.zshrc
WHY
刚才做了什么?
为什么之前会报错?
做了刚才的操作之后为什么不报错?
What are Shell Options
只关注部分:
Shell options are preferences for the shell’s behavior.
Shell options 是shell表现(行为)的首选项(参数配置)
zsh has a lot of shell options. Many of these options serve the purpose of enabling (or disabling) compatibility with other shells.
zsh有很多的shell选项。其中很多选项的目的是:启用或禁用与其他shell的兼容性。
There are also many options which are specific to zsh.
也有很多shell选项,是zsh独有的。
You can set an option with the setopt command.
你可以通过 setopt 命令设置选项值。
For compatibility with other shells the setopt command and set -o have the same effect (set an option by name).
为了与其他 shell 兼容而使用 setopt 命令,等效于使用 set -o (通过选项名去设置值)
点击链接 a lot of shell options
再次获取信息:
- 选项通过名称来引用/参考。
- 名称不区分大小写,会忽略下划线(如:
allexport
等效于A_lleXP_port
) - 在选项名前加前缀
no
可以颠倒该选项的意义。(setopt No_Beep
等效于unsetopt beep
) - …
no_match 选项
no_nomatch
nomatch
还没有评论,来说两句吧...