0

I am getting foo: not found when running the following code:

foo = "`cat test.txt`"

contents of test.txt:

Hello World
Ente
  • 2,301
  • 1
  • 16
  • 34
alemoh
  • 1

2 Answers2

1

The syntax for defining a variable is without spaces:

foo="`cat test.txt`"
noam
  • 538
  • 5
  • 19
1

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.

Ente
  • 2,301
  • 1
  • 16
  • 34