Why would this work at the command line:
redis-cli info | grep instantaneous_ops_per_sec | cut -d : -f 2
...but not work when I assign that to a variable inside a shell script? e.g.,
num=`redis-cli info` | grep instantaneous_ops_per_sec | cut -d : -f 2
Relatedly, why does assigning the raw output of redis-cli info
to a shell variable and then echoing it result in a garbled version of the redis-cli output?