Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何将shell脚本的输出存储在conky中的变量中?_Linux_Conky - Fatal编程技术网

Linux 如何将shell脚本的输出存储在conky中的变量中?

Linux 如何将shell脚本的输出存储在conky中的变量中?,linux,conky,Linux,Conky,因此,我将使用传感器命令获取CPU核心温度 在康基里面,我写道 $Core 0 Temp:$alignr${execi 1 sensors | grep 'Core 0' | awk {'print $3'}} $alignr${execibar 1 sensors | grep 'Core 0' | awk {'print $3'}} 每秒钟我都在两个地方运行完全相同的命令sensors | grep'Core 0'| awk{'print$3'},以获得完全相同的输出。是否有方法将输出保存

因此,我将使用
传感器
命令获取CPU核心温度

在康基里面,我写道

$Core 0 Temp:$alignr${execi 1 sensors | grep 'Core 0' | awk {'print $3'}} $alignr${execibar 1 sensors | grep 'Core 0' | awk {'print $3'}}

每秒钟我都在两个地方运行完全相同的命令
sensors | grep'Core 0'| awk{'print$3'}
,以获得完全相同的输出。是否有方法将输出保存在变量中,并使用该变量代替命令。

conky
没有用户变量。你能做的是打电话给康基的lua帮你做这件事。默认情况下,lua语言通常内置于conky中,因此您只需在文件中放入一些代码,将该文件包括在conky设置文件中,然后调用该函数。例如,这些shell命令将创建一个测试:

cat>/tmp/.conkyrc