5

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?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Paolo
  • 2,161
  • 5
  • 25
  • 32
  • "stop working", "suddenly didn't work" is a very imprecise description of what happened. Try to be more precise (Error message, unexpected result...) – hivert Jul 18 '13 at 13:19

1 Answers1

5

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

Community
  • 1
  • 1
Prashant Kumar
  • 20,069
  • 14
  • 47
  • 63