原文標題為「安裝完後外放和耳機同時有聲音的問題」,但內容實為桌面天氣顯示技術分享。此處依實際內容重寫標題與正文。
利用桌面小工具平台(如 Samurize、Rainmeter、Conky 等)支援 Shell 指令輸出,組合三段指令取得並顯示 Yahoo Weather 資訊。
curl --silent "https://weather.yahoo.com" | grep "forecast-icon" | sed "s/.*background:url('\(.*\)'); _background.*/\1/" | xargs curl --silent -o /tmp/weather.png
/tmp/weather.png。curl --silent "https://weather.yahooapis.com/forecastrss?p=CAXX0301&u=c" | grep -E '(Current Conditions:|C'
p=CAXX0301 為城市代碼(需自行查詢對應代碼)。u=c 為攝氏溫度,改 u=f 為華氏。file:///tmp/weather.png
CAXX0301)。p= 參數。u=c 改為 &u=f。echo "文字",多行以分號 ; 分隔。