Skip to content
Search

Bash:Source

lastmod 2014-10-01created 2014-10-012 edits

In Bash, the source command reads the commands in filename.

The basic syntax is as follows.

$ source [-h] filename

Characteristics

It has the following characteristics.

  • The current shell's environment variables are reset.
  • When a file is run with the source command, all variables set in that file become part of the current shell.

Alternative

Using . instead of source has the same effect. That is,

$ source .bash_profile

and

$ . .bash_profile

have the same effect.