0

I am trying to run a command and storing the values in a list

list = `sed -n 's/^abc//p' /etc/filename`

I am getting an error command not found while running the above command.

However, when I directly run the sed -n 's/^abc//p' /etc/filename command, the output is coming fine as below:

abc01 abc02 abc03
meallhour
  • 13,921
  • 21
  • 60
  • 117

1 Answers1

1

Use

list="$(sed -n 's/^abc//p' /etc/filename)"

There must be no spaces after variable declaration and equals sign. Also, quoting your variables is important.

Ryszard Czech
  • 18,032
  • 4
  • 24
  • 37