I am wondering after seeing this question why the .
symbol was chosen to represent the dot command?
I am not able to find much about it's origin or who created it and am curious as to why a full stop was chosen to represent this command.
I am wondering after seeing this question why the .
symbol was chosen to represent the dot command?
I am not able to find much about it's origin or who created it and am curious as to why a full stop was chosen to represent this command.
The earliest mentioning of the dot command that I can find is in the manual for Stephen Bourne's sh
shell in Unix Release 7 (it may be older, but not evidently present as one of the built-in commands in sh
in Release 6).
. file Read and execute commands from file and return. The search path
$PATH is used to find the directory containing file.
The dot, in quite general terms, seems to have been associated with "here" or "current". The .
directory is the current directory, and the .
address in the adb
debugger from the same release of Unix had a .
address which was the current address. Likewise, entering a .
followed by newline in the ed
editor will re-display the current line of the editing buffer (.
addresses the current line). The dot also means the current node in certain structured query languages for XML, JSON, YAML, etc. (although these are later inventions).
It is therefore, I think, not too far fetched to speculate that the .
command in the shell also means "here" or "current". In particular, "run this script in the current environment."
The dot is also quite quick and easy to type, and having a short command for doing a common task (whether it be in ed
, adb
or in the shell) may have been another reason why another longer name was not used.
Note that I don't have a functioning version of sh
from Release 7 to test things in, and that I can't find the actual implementation of .
in Bourne's shell from that release in the above-mentioned Git repository, so I can't say for sure that it actually did exactly what it does today. But it's likely that it did.
. scriptfile
versus source scriptfile
in bash
? In other words, are they two names of the same built-in command?
– sudodus
Jan 15 '19 at 14:57
source
command has a different history though, as it's inherited from csh
.
– Kusalananda
Jan 15 '19 at 15:17
May it be because dot
is the name of the symbol .
.
.
? – slm Jul 28 '18 at 21:54.
used to represent the dot(source) command? Is it related to.
being the current directory? – jesse_b Jul 28 '18 at 21:56