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
help
to 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.
With 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.
The command help
without parameter from the prompt give us:
GNU bash, version 4.1.2(1)...
These shell commands are defined internally.
Type help
to see this list.
Type help name
to find out more about the function name.
Use info bash
to find out more about the shell in general.
Use man -k' or
info' to find out more about commands not in this list.
Meanwhile with 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.
Exit Status:
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
bash
man 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, andsource
is the compatibility alias (for compatibility withcsh
). Note thatsource
does not exist in standard POSIX bourne shell, only.
.