Recently, I came across the Linux command source
and then found this answer on what it does.
My understanding was that source
executes the file that is passed to it, and it did work for a simple shell script. Then I tried using source
on a Python script–but it did not work.
The Python script has a shebang (e.g. #!/usr/bin/python
) and I am able to do a ./python.py
, as the script has executable permission. If that is possible, source python.py
should also be possible, right? The only difference is ./
executes in a new shell and source
executes in the current shell. Why is it not working on a .py
script? Am I missing something here?