I\'ve built up this pipeline:
echo \"scale=2;$(cat io | grep wchar | awk \'{print $2}\')/(1024^3)\" | bc
Now I\'m trying to watch
Try having watch
invoke the shell:
watch sh -c 'echo "scale=2;$(awk '/wchar/ {print $2}' io)/(1024^3)" | bc'
This is similar to having it invoke a script but without needing a separate file.
The problem is about the single quotes for awk, you could fix it by escaping single quotes.
watch 'echo "scale=2;$(cat io | grep wchar | awk '"'"'{print $2}'"'"')/(1024^3)" | bc'
It is all about how to escaping single quotes inside single quotes, there is a good explanation "BASH, escaping single-quotes inside of single-quoted strings"