Centos自动调整错误路径

来源:互联网 发布:教孩子学编程python 编辑:程序博客网 时间:2024/06/07 00:57

通常在出入路径时,经常会打错一两个字,通过一个小技巧可以避免这种错误发生,但也仅限于一个字母,系统才会自动调整
例如,要到etc目录下,下面错误的路径会报错

[root@centos ~]# cd /tec/-bash: cd: /tec/: No such file or directory

修改.bashrc或者/etc/profile配置文件,在最后一行添加

#auto fix wrong pathshopt -s cdspell

重启生效

[root@centos ~]# source ~/.bashrc

如果其他用户也需要这种功能,则须编辑/etc/bashrc或者/etc/profile
测试:

[root@centos etc]# cd /etc[root@centos etc]# pwd/etc

Tips:如果输入错误过多,也是无法修正的

0 0