shopt-option

cdspell shell option

Allows minor spelling corrections in interactive cd operands, such as a transposition. It can choose a directory you did not intend; always inspect the resulting directory. Not a general spellchecker or a script validation mechanism. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Use interactive Bash with default key bindings; expected visible result: project.

Formal Syntax & Structure

bash syntaxbash
shopt -s cdspell; shopt -u cdspell

Return Value

exit status

Returns zero on success and nonzero on failure; option queries return zero when enabled.

Working Example

Example Snippetbash
# In fresh interactive Bash in an empty private directory:mkdir projectshopt -s cdspellcd porjectprintf '%s\n' "${PWD##*/}"
Bash Reference