>>7595199Basically, you type ". ./
name.sh" to run each line of the script within your current shell (as if you'd typed the whole script into your shell) and "./
name.sh" to run it through the command specified by the shebang. In both cases, if you don't have the "./", it will look in your $PATH for something called "
name.sh", and it probably won't find anything. Of course, you need to make sure the script is also marked as executable.
For example, I have Zsh as my interactive shell, but I specify Bash in the shebang. Using "./
example.py", it starts up a bash shell and runs my script within that. Using ". ./
example.sh" (equivalent to "source
example.sh"), it just runs the script within the Zsh I already have running.
When I do a similar shenanigan with Python, "./
example2.py" works, because it started up Python2 to interpret the script. When I use ". ./
example2.py", it tries to run the lines of
example.py within my Zsh shell, which does something nonsensical.