2

is there a higher reason why the original developers of the bourne shell decided to name the source command .?

(afaik the source command is bourne specific, correct me if i'm wrong)

note that bash has an alias for . called source, which is much more readable. sh does not have this alias, that means . is not a short form for source.

2 Answers 2

2

As wikipedia states, the Bourne shell was written as a replacement to first shell ever, Thompson shell, and the latter was really stupid so it's unlikely that this design decision was derived from the predecessor. However, Bourne has used some of ALGOL 68's syntax rules, and this may be the cause... someone who knows ALGOL, please, correct me.

Such basic design decisions are rarely traceable to their roots just because they were obvious to original programmers, or taken from some common that times and now dead language, or just chosen randomly from a list of possibilities.

For me, the dot command associates with "the current something", i.e. like an alias to the interpreter in case of shellscript, and the short form means there are no process fork'd. Well, this is not a good explanation, but not worse than any other.

upd: You can also take a look at this article in ComputerWorld. While it does not answer your particular question, it may be interesting of itself.

2

They're not entirely synonymous. For example, while . is recognised by sh, it isn't built-in for csh. Likewise, while source is built-in for csh, it isn't a built-in command for sh.

I would imagine that . on sh did the same as source on csh, and thus both were implemented for compatibility reasons. I wasn't alive in the golden days of csh/sh though (if they ever were golden), so this is more speculation than anything ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .