#!/bin/bash [[ ! -d /var/lib/backuppc/pc ]] && echo "BackupPC directory not found (/var/lib/backuppc/pc)." && exit 1 if ! cd "/var/lib/backuppc/pc"; then echo "Failed to enter in BackupPC directory (/var/lib/backuppc/pc)." exit 1 fi OUT="" t_v3=0 t_v4=0 for h in *; do if [[ ! -d "$h" ]] || [[ ! -e "$h/backups" ]]; then continue fi vers=$( cut -f24 < "$h/backups" ) v3=$( grep -Evc '^4' <<< "$vers" ) ((t_v3=t_v3+v3)) [[ "$v3" -ne 0 ]] && v3="$v3" v4=$( grep -Ec '^4' <<< "$vers" ) ((t_v4=t_v4+v4)) OUT="$OUT" done [[ $t_v3 -gt 0 ]] && t_v3="$t_v3" OUT="$OUT
Host Nb backups
Before V4 After V4
$h$v3$v4
Total : $t_v3 $t_v4
" lynx -stdin <<< "$OUT" # vim:set sw=4 ts=4 sts=4 ft=bash expandtab: