Skip to content

Welcome to Tech by Example

Menu
  • Home
  • Posts
  • System Design Questions
Menu

Difference between “./”, “.” and “source” in BASH shell or terminal (Linux)

Posted on July 7, 2021July 7, 2021 by admin

Let’s understand each of these in the context of the sample test.sh file.

Using “./“

The changes made by script gets discarded as soon as scripts end because this runs script by forking a separate process. Example:

./test.sh

Using “.“

The changes made by the script persist till the terminal remains alive because the script gets executed in the same bash process. Example:

. test.sh

Using “source“

source are “.”  are synonyms and the same thing. “.” is the inclusion of POSIX standard. Example:

source test.sh
©2025 Welcome to Tech by Example | Design: Newspaperly WordPress Theme