From "man 1 bash" on 4.2.45:
cdspell If set, minor errors in the spelling of a directory com‐
ponent in a cd command will be corrected. The errors
checked for are transposed characters, a missing charac‐
ter, and one character too many. If a correction is
found, the corrected file name is printed, and the com‐
mand proceeds. This option is only used by interactive
shells.
Unless I am missing some reason why this is undesirable, it seems
sensible to return an error when attempting to set "cdspell" in a
non-interactive shell, in that case.
$ bash -c 'echo $-; shopt -s cdspell; echo $?'
hBc
0
pgp61lRrcYmIt.pgp
Description: PGP signature
