você está aqui: Home → Arquivo de Mensagens
Colaboração: Felipe Kellermann
Data de Publicação: 22 de Novembro de 2002
A bash também tem uma outra opção muito interessante, cdspell.
Para habilitar a opção, basta usar o shopt: shopt -s cdspell
com
a shell em modo interativo. Com esta opção, qualquer erro de digitação,
como troca de caracteres, falta de caractere ou caractere adicional,
será arrumado pela shell e o comando vai ser executado normalmente.
/$ cd homr bash: cd: homr: No such file or directory /$ shopt -s cdspell /$ cd homr home /home$ cd ../hom ../home /home$
Segundo a man page (man bash)
shopt [-pqsu] [-o] [optname ...] Toggle the values of variables controlling optional shell behavior. With no options, or with the -p option, a list of all settable options is displayed, with an indica tion of whether or not each is set. The -p option causes output to be displayed in a form that may be reused as input. Other options have the following meanings: -s Enable (set) each optname. -u Disable (unset) each optname. -q Suppresses normal output (quiet mode); the return status indicates whether the optname is set or unset. If multiple optname arguments are given with -q, the return status is zero if all optnames are enabled; non-zero otherwise. -o Restricts the values of optname to be those defined for the -o option to the set builtin.
e ainda
cdspell If set, minor errors in the spelling of a directory component in a cd command will be corrected. The errors checked for are transposed characters, a miss ing character, and one character too many. If a correction is found, the corrected file name is printed, and the command proceeds. This option is only used by interactive shells.