The following commands are the same, a dot component means "current directory". To allow for being executed, the files need to have executable permissions:
path/to/binary
./path/to/binary
Note that if a path does not contain a slash, it is treated as a command (either a shell built-in or a program that is looked up in the $PATH
environment variable).
The following are almost the same, they execute a shell script (not a binary!) in the current shell environment. A small difference between the two lines are described on this Unix.SE question.
. path/to/script
source path/to/script
Finally you mentioned sh script
. Again, this only works for shell scripts and not binaries. You are basically executing the sh
program with the script name as argument. In the case of sh
, it just treats this argument as shell script and executes it.
For answers restricted to shellscripts, see Different ways to execute a shell script.