Operating System - HP-UX
1752765 Members
5039 Online
108789 Solutions
New Discussion юеВ

A question about intrinsic command in shell

 
SOLVED
Go to solution
Wang,MinJie
Super Advisor

A question about intrinsic command in shell

As we all know,Posix-Shell has its own intrinsics such as ls,cd and so on, while these commands are also available as unix command and exist in the file system(like "ls").So I want to know that when I run "ls" in the shell,which command will it actually run? The shell intrinsics or unix command which locates in the unix file system and prove that?
Thx in advance
3 REPLIES 3
Steven Schweda
Honored Contributor
Solution

Re: A question about intrinsic command in shell

"ls"?

td176> type ls
ls is a tracked alias for /usr/bin/ls

td176> type cd
cd is a shell builtin.

If you want "/bin/ls", then _say_ "/bin/ls".

man sh

man sh-posix
Peter Godron
Honored Contributor

Re: A question about intrinsic command in shell

Hi,
please see:
http://www.robelle.com/library/smugbook/whence.html

For Korn shell,I would use whence, which is going to tell you what you are running.
For your Posix, type.

Earlier thread with a similar theme:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=706680
Dennis Handly
Acclaimed Contributor

Re: A question about intrinsic command in shell

Basically cd has to be builtin. While the shell can do "globbing", to expand wildcards, ls(1) is still done by the command.

Besides Pete's mention of whence, you can look at the sh-posix or ksh man pages and look under "Special Commands" for builtins.