I have the following file f1.txt:
A=0 A=\`expr $A + 1\`
and the following script file s1.sh
for line in $(cat testfile.txt) do echo "$line" # eval $line done echo $A
When I run the script using "sh s1.sh" I get the following output:
A=0 A=`expr $A + 1`
I was expecting the output of the echo to be:
"A=`expr $A + 1`"
- I'd like to know why echo is putting newlines between the words?
As well, when I uncomment the
evalline I get the following error:
s1.sh: eval: line 4: unexpected EOF while looking for matching ``' s1.sh: eval: line 5: syntax error: unexpected end of file
I'd like to know what's wrong.