shopt -s dirspell做什么?

Spa*_*tan 13 bash shopt

我无法弄明白,我理解shopt -s cdspell但却无法找出shopt -s dirspell的作用.

Bash参考指南说:

dirspell

如果设置,如果最初提供的目录名不存在,Bash会在字完成期间尝试对目录名进行拼写更正.

我在几个目录上尝试了几次,但这不是行为.

我在i386-apple-darwin10.7.0上使用bash 4.2.10(2)

Fre*_*ihl 10

更改日志

X.有一个新的shell选项:`dirspell'.启用后,文件名完成代码会在完成期间对目录名称执行拼写更正.

我们试试吧:

$ ls
spam/

$ cat spam/test 
hello world
Run Code Online (Sandbox Code Playgroud)

dirspell

$ cat span/test [tab]
# nothing happens
Run Code Online (Sandbox Code Playgroud)

与dirspell

$ shopt -s dirspell
$ cat span/test [tab]
#line is replaced by
$ cat /home/user/tmp/shopt/spam/test
Run Code Online (Sandbox Code Playgroud)

  • 当我点击 tab 时,我没有看到任何事情发生,并且打开了 `dirspell`。 (2认同)

小智 5

如果您设置外壳程序选项direxpanddirspell,则制表符全确实起作用。