I saw a post about fix your alias in .bashrc
.
And he says after you put your alias in .bashrc
, you need to use:
. ~/.bashrc
I do not quite understand what the first dot(' . ') does here. What's its function and what is it called?
I saw a post about fix your alias in .bashrc
.
And he says after you put your alias in .bashrc
, you need to use:
. ~/.bashrc
I do not quite understand what the first dot(' . ') does here. What's its function and what is it called?
Interesting... the name seems to be dot-command
, in your case it includes the .bashrc into the calling shell program (in your case, your bash environment). As you are calling it from the command line, it updates your environmental variables, as variables are set in .bashrc.
echo "FOO=bar" > test
echo $FOO
no result, env variable not set. But after you source the "test" file:
. test
the env variable FOO is set and
echo $FOO
result in the output of
bar
I found the following info here:
Sourcing a file (dot-command) imports code into the script, appending to the script (same effect as the #include directive in a C program). The net result is the same as if the "sourced" lines of code were physically present in the body of the script. This is useful in situations when multiple scripts use a common data file or function library.
Also, see this question. In bash, .
is the same as source
.