De acordo com as Leis 12.965/2014 e 13.709/2018, que regulam o uso da Internet e o tratamento de dados pessoais no Brasil, ao me inscrever na newsletter do portal DICAS-L, autorizo o envio de notificações por e-mail ou outros meios e declaro estar ciente e concordar com seus Termos de Uso e Política de Privacidade.
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.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Comentários