To activate a TurboGears virtualenv (just as an example), you do this:
. bin/activate
Or this:
source bin/activate
-
Why does the current directory “.” work as a command?
-
Why use “source” or “.” at all? Why not simply “bin/activate”?
(I did a little Web searching on this, but “.” and “source” get a lot of bad hits.)
.doesn’t mean ‘current directory’ in that context. It’s just shorthand forsource.sourcing a script (using
.orsource) runs the script in your current shell’s context, rather than starting a subshell. That means it can make modifications to your current shell’s environment. Simply running a script can’t do that. Example: