基本上,指令运作的顺序可以这样看:1.以相对路径、绝对路径执行。比如以绝对路径执行:/bin/ls;以相对路径执行,到/bin目录下,./ls2.由alias找到该指令来执行。3.由bash内建的(b
基本上,指令运作的顺序可以这样看:
1.以相对路径、绝对路径执行。比如以绝对路径执行:/bin/ls;以相对路径执行,到/bin目录下,./ls
2.由alias找到该指令来执行。
3.由bash内建的(builtin)指令来执行。
4.透过$PATH这个变量的顺序搜寻到的第一个指令来执行。
下面来跟踪下ls命令搜寻的顺序:
[email protected]:/root/Downloads>type -a ls
ls is aliased to `ls --color=auto'
ls is /bin/ls