What are the differences between
. scriptname.sh and
./scriptname.sh when executing scripts?
Running a program in Bash
Executing a script is simple in Bash and many other shells.
The shell commands above will execute the
scriptname.sh script as a separate program from the command line. It may be any type of script.
Sourcing a script in Bash
When a file is sourced, it runs in the current user’s shell as if the commands were typed out.
The most common use case is when scripts export environment variables.