I was just reading up on how Unix shells work (
bash in particular),
and I tried something that didn't make sense to me.
As I understand it, the
source command runs the program you give it in the current shell process instead of forking a child process.
On the other hand, running a command followed by
& returns control to the user before the process that runs finishes. If you run a command without
source but with
&, the current shell returns control to the user before the child process exits.
But when I created a file called
hello world, and ran:
source /bin/cat test.txt
… I got
-bash: ????: command not found.
Similarly, when I tried to load my virtualenv using
source ./venv/bin/activate &
I just got the exit status and process id
What's going on? Particularly for the second command. I’m confused.
source work, and what happens when you use it with