diff options
author | Paweł Krupa <pawel@krupa.net.pl> | 2018-09-13 10:24:05 +0200 |
---|---|---|
committer | Costa Tsaousis <costa@tsaousis.gr> | 2018-09-13 11:24:05 +0300 |
commit | fef1d0c06ed0ecc9da2f27655f885027315fc91e (patch) | |
tree | 83efe3d412c5ac76901a5879f6b8cd735924ca17 /charts.d/hddtemp.chart.sh | |
parent | 16b2a57ad0ab7ac40a7e1ecdebcc02c881086366 (diff) |
more linting of bash modules (#4183)
Diffstat (limited to 'charts.d/hddtemp.chart.sh')
-rw-r--r-- | charts.d/hddtemp.chart.sh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/charts.d/hddtemp.chart.sh b/charts.d/hddtemp.chart.sh index 0795db8467..62d74ce051 100644 --- a/charts.d/hddtemp.chart.sh +++ b/charts.d/hddtemp.chart.sh @@ -31,13 +31,14 @@ hddtemp_create() { local all all=$(nc $hddtemp_host $hddtemp_port ) unset hddtemp_disks - hddtemp_disks=( `grep -Po '/dev/[^|]+' <<< "$all" | cut -c 6-` ) + # shellcheck disable=SC2190,SC2207 + hddtemp_disks=( $(grep -Po '/dev/[^|]+' <<< "$all" | cut -c 6-) ) fi # local disk_names # disk_names=(`sed -e 's/||/\n/g;s/^|//' <<< "$all" | cut -d '|' -f2 | tr ' ' '_'`) echo "CHART hddtemp.temperature 'disks_temp' 'temperature' 'Celsius' 'Disks temperature' 'hddtemp.temp' line $((hddtemp_priority)) $hddtemp_update_every" - for i in `seq 0 $((${#hddtemp_disks[@]}-1))`; do + for i in $(seq 0 $((${#hddtemp_disks[@]}-1))); do # echo "DIMENSION ${hddtemp_disks[i]} ${disk_names[i]} absolute 1 1" echo "DIMENSION ${hddtemp_disks[$i]} '' absolute 1 1" done @@ -45,13 +46,14 @@ hddtemp_create() { } # _update is called continuously, to collect the values -hddtemp_last=0 -hddtemp_count=0 +#hddtemp_last=0 +#hddtemp_count=0 hddtemp_update() { # local all=( `nc $hddtemp_host $hddtemp_port | sed -e 's/||/\n/g;s/^|//' | cut -d '|' -f3` ) # local all=( `nc $hddtemp_host $hddtemp_port | awk 'BEGIN { FS="|" };{i=4; while (i <= NF) {print $i+0;i+=5;};}'` ) OLD_IFS=$IFS set -f + # shellcheck disable=SC2207 IFS="|" all=( $(nc $hddtemp_host $hddtemp_port 2>/dev/null) ) set +f IFS=$OLD_IFS |