Wednesday, 14 August 2013

About builtin command puzzle

About builtin command puzzle

[root@MGWSDT_FEWS bin]# type cd
cd is a shell builtin
[root@MGWSDT_FEWS bin]# which cd
/usr/bin/which: no cd in
(.:/usr/expect/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/real/RealPlayer:/root/bin)
It says that because cd is a builtin command, so 'which cd' failed.
'pwd' is also a builtin command, why 'which pwd' can get its location?
[root@MGWSDT_FEWS ~]# type pwd
pwd is a shell builtin
[root@MGWSDT_FEWS ~]# which pwd
/bin/pwd

No comments:

Post a Comment