4

For example, 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?

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Harty
  • 316
  • 2
  • 12

2 Answers2

10

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
  • 116,958
  • 15
  • 196
  • 339
  • 1
    +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 Jul 10 '09 at 05:16
3

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
  • 15,513
  • 4
  • 22
  • 14
  • 3
    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 Jul 10 '09 at 05:34