Thanks for the replies.
Suggest solution works for assigning to varaible. But my issue is different.
Let me explain.
I have file test_file in one unix server. Where it has a line as below
DEPLOYMENT="abc" # com
I have an expect script, to execute any command on this unix server. usage of that expect script is
echo "<command>" | ./sshTargetasroot
Now my task is to fetch "abc" from test_file and read to some varaible, by echoing this command to expect script.
When I tried to read to varaible usng `<command>` I am facing this unexpected EOF error. Directly executing command, I am able to get the value as shown below