Penguin
Blame: ShellBuiltinNotes
EditPageHistoryDiffInfoLikePages
Annotated edit history of ShellBuiltinNotes version 5 showing authors affecting page license. View with all changes included.
Rev Author # Line
1 BenStaz 1 In Unix, a shell builtin is a command or a function, called from a [Shell], that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute.
2
3 !How can I tell if the command I am using is a shell builtin rather than an external program?
4
5 *type <command_name>
6
7 <verbatim>
8 $ type cd
9 cd is a shell builtin
10
11 $ type mkdir
12 mkdir is /bin/mkdir
13 </verbatim>
2 BenStaz 14
15 !But I want to use an external program rather than a shell-builtin.
16
17 If a command specified to the shell contains a slash ''/'', the shell will not execute a builtin command. Thus, while specifying ''echo'' causes a builtin command to be executed under shells that support the builtin echo command, specifying ''/bin/echo'' does not.
18
19 !Why can I not use ''sudo <shell_builtin>'' ?
20
21 A shell builtin is not an executable file so sudo does not know about it. (obviously wont be found in any dirs in sudo's PATH).
22 You will need to use the command ''sudo -s'' to get a new shell with root privileges or alternatively you can do ''sudo bash -c "<shell_builtin>" ~[args~]''.