Here are some of the basic ways you can execute scripts on the command line.
. will read and execute commands from filename in the current shell environment.
Any environment variables set within the script will remain after exit.
. test.sh source test.sh
bash will fork a new shell with the specified interpreter.
sh test.sh bash test.sh
./ will also fork a new shell, but the file needs to be set as executable and interpreter will be derived from the shebang (
chmod +x test.sh ./test.sh