Explorar el Código

Fix `zfs-backup` previous-snapshot search

The `head -n 1` call is useless after the output of `zfs list` has been
placed into a variable, as the newlines in formatting are destroyed.
cinaeco hace 9 años
padre
commit
53b184c298
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      bin/zfs-backup

+ 2 - 2
bin/zfs-backup

@@ -21,8 +21,8 @@ echo "Destination:   $fsTo"
 snapPrefix="manualbackup"
 
 # Look for a previous snapshot created by this script.
-snapList=$(zfs list -Ht snapshot | grep $snapPrefix || true)
-prevSnap=$(echo $snapList | head -n 1 | sed 's/.*@\([^ ]*\)\ *.*/\1/')
+snapLine=$(zfs list -Ht snapshot | grep $snapPrefix | head -n 1 || true)
+prevSnap=$(echo $snapLine | sed 's/.*@\([^ ]*\)\ *.*/\1/')
 echo "Prev Snapshot: ${prevSnap:-none}"
 
 # Next snapshot will be marked with today's date.