This question already has an answer here:

I know how to set a BASH variable equal to the output from a command, but it doesn't work in case of 'top' command for me, see below

cat aTOPFWK.sh
OUTPUT = $(top -b -n 1 | egrep 'fwk3' |  awk '{print $9}')
echo "${OUTPUT}"
./aTOPFWK.sh: line 3: OUTPUT: command not found

marked as duplicate by terdon bash Nov 26 '15 at 17:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


get rid of the blanks around the "=":

OUTPUT=$(top -b -n 1 | egrep 'fwk3' |  awk '{print $9}')
echo "${OUTPUT}"

Not the answer you're looking for? Browse other questions tagged or ask your own question.