CDPATH:改变目录路径变量,保留一系列由冒号隔开的路径名,用于cd命令。如果设置了CDPATH,cd一个目录时,首先查找CDPATH,如果CDPATH指明此目录,则此目录成为当前工作目录。例子如下:
[[email protected] ~]$ pwd /home/staff/clu [[email protected] ~]$ cd hello -bash: cd: hello: No such file or directory [[email protected] ~]$ export CDPATH=/home/staff/clu/helloworld/ [[email protected] ~]$ cd hello /home/staff/clu/helloworld/hello [[email protected] hello]$ pwd /home/staff/clu/helloworld/hello [[email protected] hello]$