1

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
0

1 Answer 1

1

get rid of the blanks around the "=":

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.