I am getting command not found error for code below:
#!/bin/sh
#set -x
for i in `cat output`;
do
eval "MASTER_$i = $(/usr/efm-2.0/bin/efm cluster-status $i 2>/dev/null |grep "Master" |head -1 |awk -F " " {'print$2'})";
echo -e "$MASTER_$i";
done
Debug output is:
./test.sh
++ cat output
+for i in '`cat output`'
++ /usr/efm-2.0/bin/efm cluster-status abc
++ grep Master
++ head -1
++ awk -F ' ' '{print$2}'
+eval 'MASTER_abc = 10.x.x.x'
++ MASTER_abc = 10.x.x.x
**./test.sh: line 5: MASTER_abc: command not found**
+echo -e abc
abc
whileloop.