简体   繁体   English

如何通过genmon正确格式化df管道?

[英]How to correctly format df pipe through genmon?

I am having trouble with command output formatting. 我在命令输出格式方面遇到麻烦。

In terminal this works nicely: 在终端中,这很好用:

df | grep sda1 | head -c33 | tail -c7 | tr -d " "

In genmon, I get only numbers such as "1145944": 在genmon中,我只得到诸如“ 1145944”的数字:

SDAFREE=$(df | grep sda1 | head -c33 | tail -c7 | tr -d " ")
echo="$SDAFREE"

How do I print that command's output through genmon to xfce panel correctly (same as in terminal)? 如何通过genmon将命令的输出正确打印到xfce面板(与终端相同)?

Thank you. 谢谢。

I have the same issue with every command with a pipe. 对于带有管道的每个命令,我都有同样的问题。 As a workaround I put the command in a executable script and run the script in genmon. 解决方法是将命令放在可执行脚本中,然后在genmon中运行该脚本。

BTW: if you want just one value of a table, you can use awk instead of head, tail and tr: 顺便说一句:如果只需要一个表的值,则可以使用awk代替head,tail和tr:

df | awk '/sda1/ {print $4}'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM