zfs_count: bash lint

This commit is contained in:
Michael Grote 2021-10-01 11:00:50 +02:00
parent eeaaedadf0
commit e79510f163

View file

@ -19,8 +19,8 @@ if [ "$1" = "config" ]; then
# https://superuser.com/questions/284187/bash-iterating-over-lines-in-a-variable # https://superuser.com/questions/284187/bash-iterating-over-lines-in-a-variable
while read -r line; do while read -r line; do
# setze label <pool>.label <pool> snapshots # setze label <pool>.label <pool> snapshots
echo $line | awk '{print $1"_snapshot.label " $1 " snapshots"}' echo "$line" | awk '{print $1"_snapshot.label " $1 " snapshots"}'
echo $line | awk '{print $1"_dataset.label " $1 " datasets"}' echo "$line" | awk '{print $1"_dataset.label " $1 " datasets"}'
done <<< "$list_pools" done <<< "$list_pools"
echo 'pools.label pools' echo 'pools.label pools'
# setze optionen # setze optionen
@ -35,11 +35,11 @@ fi
# tue für jede Zeile # tue für jede Zeile
# "echo" die Zeile, wende awk drauf, Spalte $1/$7 # "echo" die Zeile, wende awk drauf, Spalte $1/$7
while read -r line; do while read -r line; do
echo pools.value $(zpool list | sed 1d | wc -l) echo pools.value "$(zpool list | sed 1d | wc -l)"
# setze poolnamen # setze poolnamen
poolname=$(echo $line | awk '{ print $1 }') poolname=$(echo "$line" | awk '{ print $1 }')
# zähle snapshots # zähle snapshots
echo $poolname"_snapshot.value" $(zfs list -r -t snapshot $poolname| sed 1d | wc -l) echo "$poolname""_snapshot.value" "$(zfs list -r -t snapshot "$poolname" | sed 1d | wc -l)"
echo $poolname"_dataset.value" $(zfs list -r $poolname| sed 1d | wc -l) echo "$poolname""_dataset.value" "$(zfs list -r "$poolname" | sed 1d | wc -l)"
done <<< "$list_pools" done <<< "$list_pools"
exit 0 exit 0