コード:
first=true
mountpoint=" "
partlist=`df -h | grep "^/dev"` # get partition info
for i in $partlist # loop through info
do
if [[ ${i:0:1} = "/" ]] # items starting with / are what I'm interested in
then
if [[ $first ]] # The first instance in each pair is the device name
then
mountdev=$i
mountpoint=" "
first=false
else # The second instance is the device mount point
mountpoint=$i
first=true
fi
if [[ $mountpoint != " " ]] # If the mountpoint was just set (last to be set
# before printing config)
then
# Print config
echo "${mountpoint} \${fs_size ${mountpoint}"
echo "USED \${fs_used ${mountpoint}}\${alignr}\${fs_free ${mountpoint}} FREE"
echo "\${fs_bar 3,300 ${mountpoint}}"
echo "READ \${diskio_read ${mountdev}}\${alignr}\${diskio_write ${mountdev}} WRITE"
echo ""
fi
fi
done
問題:
目標は、コンピューターごとにファイルを編集することなく、コンピューターごとに好みの conky 構成を生成するスクリプトを作成することです。上記は、ディスクの使用状況に関する情報を報告するセクションを生成するスニペットです。残念ながら、何も出力できませんでした。私はそれにさまざまなデバッグエコーを投げますが、実際に構成を出力するifステートメントを除いて、すべて正しく機能しているようです。私はそれの何が悪いのか理解できません。提案や支援はありますか?
よろしくお願いします:)