通常在出入路径时,经常会打错一两个字,通过一个小技巧可以避免这种错误发生,但也仅限于一个字母,系统才会自动调整
例如,要到etc目录下,下面错误的路径会报错
```
[root@centos ~]# cd /tec/
-bash: cd: /tec/: No such file or directory
```
修改.bashrc或者/etc/profile配置文件,在最后一行添加
```
#auto fix wrong path
shopt -s cdspell
```
重启生效
```
[root@centos ~]# source ~/.bashrc
```
如果其他用户也需要这种功能,则须编辑/etc/bashrc或者/etc/profile
测试:
```
[root@centos etc]# cd /etc
[root@centos etc]# pwd
/etc
```
Tips:如果输入错误过多,也是无法修正的
例如,要到etc目录下,下面错误的路径会报错
```
[root@centos ~]# cd /tec/
-bash: cd: /tec/: No such file or directory
```
修改.bashrc或者/etc/profile配置文件,在最后一行添加
```
#auto fix wrong path
shopt -s cdspell
```
重启生效
```
[root@centos ~]# source ~/.bashrc
```
如果其他用户也需要这种功能,则须编辑/etc/bashrc或者/etc/profile
测试:
```
[root@centos etc]# cd /etc
[root@centos etc]# pwd
/etc
```
Tips:如果输入错误过多,也是无法修正的
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29812844/viewspace-1988777/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29812844/viewspace-1988777/