Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens when I execute a unix shell script using a '.' command?

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?

like image 762
Harty Avatar asked Dec 13 '22 03:12

Harty


2 Answers

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.

like image 181
Sinan Ünür Avatar answered Dec 15 '22 16:12

Sinan Ünür


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).

like image 30
TheBonsai Avatar answered Dec 15 '22 17:12

TheBonsai