views:

286

answers:

3

For e.g., when I say ". .bashrc" on my linux command prompt, is there a corresponding binary/script that gets executed in place of the first dot? If the dot itself is a command, where is its location?

+6  A: 

The . operator is shorthand for the source Bash builtin (as pointed out by John Kugelman below). Typing

help .

or

help source

at the Bash prompt will give you some information. For more on how source works, see http://www.ss64.com/bash/period.html.

Sinan Ünür
+1 Key is that it is a shell builtin, not a separate binary. You can type `help` at a bash prompt to see all of the other builtins.
John Kugelman
+3  A: 

Additionally I want to point out that you don't "execute" anything with it (in terms of fork/exec), which is very important (and probably the only reason '.' exists).

TheBonsai
One key point - a consequence of the dot command not executing anything - is that if the dotted script sets variables, it sets them in the shell that dots the script, not in some sub-shell.
Jonathan Leffler
+1  A: 

Also see this question on Server Fault.

Dennis Williamson