I am getting foo: not found when running the following code:
foo = "`cat test.txt`"
contents of test.txt:
Hello World
I am getting foo: not found when running the following code:
foo = "`cat test.txt`"
contents of test.txt:
Hello World
When you omit the spaces around the = it will work.
foo="`cat test.txt`"
With the space after foo, bash tries to run the command foo with = as first argument and "`cat test.txt`" as second argument. But since you don't have an executable in your path called foo, bash then complains that it can not find foo.