5

検索可能なキーワードの意味が広いため、自分がやろうとしていることをグーグルで検索するのに苦労しています。

.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}

またはそのようなもの?

4

1 に答える 1

13

AND をシミュレートするには、次のように 2 つのネストされた IF を使用できます。

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

(ダブル ${endif}に注意してください: 2 つの IF を開く場合は、2 つの IF を閉じる必要があります)

2 つの IF をネストする elseif をシミュレートすることもできます。

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

(読みやすくするためのバックスラッシュ)

于 2013-11-07T00:12:22.373 に答える