如何清理输出命令的bash脚本的输出

如何清理输出命令的bash脚本的输出,bash,Bash,所以我有这个剧本。它输出服务器的临时数据。当您在bash脚本中正常运行它时,它看起来是这样的 #!/bin/bash echo $(sensors -f) sleep 20 done 它输出服务器的临时数据。当您在bash脚本中正常运行它时,它看起来是这样的 #!/bin/bash echo $(sensors -f) sleep 20 done 这看起来不错。除非你用脚本运行它,你会得到这个 您是否看到与第一次输出相比,这看起来不可读?那么,如何使在脚本中运行时得到的数据的输出

所以我有这个剧本。它输出服务器的临时数据。当您在bash脚本中正常运行它时,它看起来是这样的

#!/bin/bash

echo $(sensors -f)

sleep 20

done
它输出服务器的临时数据。当您在bash脚本中正常运行它时,它看起来是这样的

#!/bin/bash

echo $(sensors -f)

sleep 20

done
这看起来不错。除非你用脚本运行它,你会得到这个

您是否看到与第一次输出相比,这看起来不可读?那么,如何使在脚本中运行时得到的数据的输出看起来像我刚运行standalone命令时得到的数据呢


无论如何,我只是使用了watch sensors-f,这对我的工作非常有用。

代码中没有循环可以证明行为或done语句是正确的。。。。
i5k_amb-isa-0000 Adapter: ISA adapter Ch. 0 DIMM 0: temp1_input: 63.000 temp1_max: 124.000 temp1_min: 105.000 temp1_alarm: 0.000 Ch. 0 DIMM 1: temp2_input: 60.500 temp2_max: 120.000 temp2_min: 105.000 temp2_alarm: 0.000 Ch. 1 DIMM 0: temp3_input: 61.000 temp3_max: 124.000 temp3_min: 105.000 temp3_alarm: 0.000 Ch. 1 DIMM 1: temp4_input: 56.500 temp4_max: 124.000 temp4_min: 105.000 temp4_alarm: 0.000 Ch. 2 DIMM 0: temp5_input: 70.500 temp5_max: 124.000 temp5_min: 105.000 temp5_alarm: 0.000 Ch. 2 DIMM 1: temp6_input: 57.000 temp6_max: 124.000 temp6_min: 105.000 temp6_alarm: 0.000 Ch. 3 DIMM 0: temp7_input: 55.500 temp7_max: 120.000 temp7_min: 105.000 temp7_alarm: 0.000 Ch. 3 DIMM 1: temp8_input: 64.000 temp8_max: 124.000 temp8_min: 105.000 temp8_alarm: 0.000 coretemp-isa-0000 Adapter: ISA adapter Core 0: temp2_input: 50.000 temp2_max: 82.000 temp2_crit: 100.000 temp2_crit_alarm: 0.000 Core 1: temp3_input: 46.000 temp3_max: 82.000 temp3_crit: 100.000 temp3_crit_alarm: 0.000 Core 2: temp4_input: 49.000 temp4_max: 82.000 temp4_crit: 100.000 temp4_crit_alarm: 0.000 Core 3: temp5_input: 48.000 temp5_max: 82.000 temp5_crit: 100.000 temp5_crit_alarm: 0.000 coretemp-isa-0001 Adapter: ISA adapter Core 0: temp2_input: 54.000 temp2_max: 82.000 temp2_crit: 100.000 temp2_crit_alarm: 0.000 Core 1: temp3_input: 48.000 temp3_max: 82.000 temp3_crit: 100.000 temp3_crit_alarm: 0.000 Core 2: temp4_input: 48.000 temp4_max: 82.000 temp4_crit: 100.000 temp4_crit_alarm: 0.000 Core 3: temp5_input: 48.000 temp5_max: 82.000 temp5_crit: 100.000 temp5_crit_alarm: 0.000