-->

Dot space ( [dot][space][filename] )

2019-01-18 04:07发布

问题:

What does a command with format [dot][space][filename] means?

Example

. ./setup.sh

Also in .bashrc file we have a line like that

. "$HOME/.bashrc"

What does this mean?

回答1:

'.' operator is also known as 'source'

According to this forum thread, the first '.' is the command 'source' to read and execute commands from the filename given as argument. The second '.' is the current directory.

. ./setup.sh

is the same as

source ./setup.sh

or source setup.sh (if the ./, the current directory, is in the PATH environment variable).

Here is the manual for that http://ss64.com/bash/source.html

This is typically used to run the script in the current shell to help set up the environment for execution, as well as to set up aliases.