Your answers in brief:
. absolute_path/mycommand source the script file
mycommand that is in the directory
absolute_path/. For further references read here
- Yes . and
source are equivalent.
- When needed, ask
bash shell itself. You will have an answer for built in commands.
Some words more
Often the most simple way is the most elusive too: we didn't think we can ask
help to the shell itself, when commands are defined internally.
type . and
type source we can notice that those are built-in commands.
Hastur@Cthulhu:~> type . source
. is a shell builtin
source is a shell builtin
Once that we know it, with
help we can have some quick information about them.
help without parameter from the prompt give us:
GNU bash, version 4.1.2(1)...
These shell commands are defined internally.
help to see this list.
help name to find out more about the function name.
info bash to find out more about the shell in general.
man -k' orinfo' to find out more about commands not in this list.
help . as well as
help source you obtain the same identical help:
source: source filename [arguments]
Execute commands from a file in the current shell.
Read and execute commands from FILENAME in the current shell. The
entries in $PATH are used to find the directory containing FILENAME.
If any ARGUMENTS are supplied, they become the positional parameters
when FILENAME is executed.
Returns the status of the last command executed in FILENAME; fails if
FILENAME cannot be read.
"The obvious is that which is never seen until someone expresses it simply."K.Gibran
bashman page as this is a built in command, search for the explanation for source, it is difficult to miss.
.a shortcut for the source command?" — it's really the other way around:
.is the command, and
sourceis the compatibility alias (for compatibility with
csh). Note that
sourcedoes not exist in standard POSIX bourne shell, only