我已经建立了这个管道:
echo "scale=2;$(cat io | grep wchar | awk '{print $2}')/(1024^3)" | bc
现在我正在努力watch
。我对 Bash 的了解非常特别,所以我没有成功。尝试过类似的事情:
watch echo "scale=2;$(cat io | grep wchar | awk '{print $2}')/(1024^3)" | bc # I understand why this fails
watch 'echo "scale=2;$(cat io | grep wchar | awk '{print $2}')/(1024^3)" | bc' # Not enough bash understanding to understand why this fails
我究竟做错了什么?
编辑
样本输出cat io
是
rchar: 36713294562
wchar: 36788363400
syscr: 27050
syscw: 2314540
read_bytes: 36709928960
write_bytes: 0
cancelled_write_bytes: 0