Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does shopt -s dirspell do?

Tags:

bash

shopt

I cannot figure it out, i understand shopt -s cdspell but cannot find out what shopt -s dirspell does.

The Bash Reference Guide says:

dirspell

If set, Bash attempts spelling correction on directory names during word completion if the directory name initially supplied does not exist.

I tried several times on several directories but that is not the behavior.

I'm using bash 4.2.10(2) on i386-apple-darwin10.7.0

like image 251
Spartan Avatar asked Jun 22 '11 10:06

Spartan


People also ask

What is Shopt used for?

Shopt is a built-in command in Unix-like operating systems, such as macOS and Linux distributions. The “shopt” command provides control over many settings that are used to tweak the operations in a Bash shell.

What is Shopt Dotglob?

In bash, shopt -s dotglob is the only way of matching every file in the directory without accidentally matching . or .. . However, fish shell can never match . or .. with globs, therefore that's not an issue (if you seriously need to match . or .. for some silly reason, just say them explicitly).


1 Answers

From the change-log

x. There is a new shell option: `dirspell'. When enabled, the filename completion code performs spelling correction on directory names during completion.

Let's try:

$ ls
spam/

$ cat spam/test 
hello world

without dirspell

$ cat span/test [tab]
# nothing happens

with dirspell

$ shopt -s dirspell
$ cat span/test [tab]
#line is replaced by
$ cat /home/user/tmp/shopt/spam/test
like image 83
Fredrik Pihl Avatar answered Nov 13 '22 20:11

Fredrik Pihl