康基与if_match和"和"



我很难在谷歌上搜索我想要做的事情,因为我的可搜索关键字的含义太宽泛了。

我试图修改我的。conkyrc文件,以改变基于温度的字体颜色,这需要我写这样的东西:

if [ $test >="50" and $test <="60"];

我不期望上面的工作,我知道语法是错误的,但这是最简单的方式来描述我想要完成的

下面是我的配置中的一个实际片段,我试图在没有'and'或'or'的情况下这样做,但当然,它不像我希望的那样工作。

${goto 45}${if_match "${platform coretemp.0 temp 2}" >= "115"}${color4}${endif}${if_match "${platform coretemp.0 temp 2}" >= "125"}${color5}${endif}${if_match "${platform coretemp.0 temp 2}" >= "145"}${color6}${endif}${if_match "${platform coretemp.0 temp 2}" >= "155"}${color7}${endif}${if_match "${platform coretemp.0 temp 2}" >= "170"}${color8}${endif}${platform coretemp.0 temp 2}°F

也,我可以使用conky的elseif吗?

${if_match "$test" >="113"}${color4}${elseif "$test1" <="120"}${color5}${endif}

之类的?

可以使用两个嵌套的if来模拟AND,如下所示:

${if_match ${battery_percent BAT0} <= 60}${if_match ${battery_percent BAT0} >=50} my battery is between 50 and 60 ${endif}${endif}

(注意双${endif}:如果打开两个if,则应该关闭两个if)

你也可以模拟一个elseif嵌套两个if:

${if_match "$test" >="113"}${color4}
    ${else}${if_match "$test" <="120"}${color5}${endif}
${endif}  

最新更新