Paolo
Paolo

Reputation: 2249

Difference between "source" and "."

I am trying to learn Bash, and I came across source - very handy. However, when I tried to use source from scripts in different folders and created by different users, it suddenly didn't work. While searching online, I learned about . (a period). It's supposed to be a synonym of source, but I tried changing just for the sake of it. And it worked. So now I'm curious.

What is the difference between:

source

and

.

If really none, am I just imagining things?

Upvotes: 5

Views: 1001

Answers (1)

Prashant Kumar
Prashant Kumar

Reputation: 22679

In bash, they are synonymous.
See https://askubuntu.com/questions/25488/what-is-the-difference-between-source-and-in-bash

About other flavors of shells, they may only have ., so source may be considered a bashism.

(Which is kinda too bad, I find source more readable than ., though I suppose we wouldn't use bash for maximum readability.)

Upvotes: 5

Related Questions