I have a file which has the following text written into it -
hello h.i. b-y-e
I want to read this value into a variable. I have defined a function -
function read() { p=`cat $1`; echo "$p"; $2=`echo "$p"`; }
I get the following error -
hello h.i. b-y-e
-bash: v=hello: command not found
However, when I do -
p=`cat $filename`
text=`echo "$p"`
I have the desired string text. Can someone please explain the difference in behaviour as well as a way to acheive what I want to do.