From 24af09986f2d7393a8cb0bba8f49e4c14c80d4be Mon Sep 17 00:00:00 2001 From: david Date: Mon, 30 Oct 2023 12:17:37 +0100 Subject: [PATCH] fixed a bug when btrfs subvol is / --- btrfs-snapshots.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/btrfs-snapshots.sh b/btrfs-snapshots.sh index f15dd2e..d0c7508 100755 --- a/btrfs-snapshots.sh +++ b/btrfs-snapshots.sh @@ -158,7 +158,11 @@ if [[ -z "$1" ]]; then exit 0 else if is_subvolume "$1"; then - SNAP_FOLDER="${1%/}/$SNAP_FOLDER" + if [[ "$1" == "/" ]]; then + SNAP_FOLDER="/$SNAP_FOLDER" + else + SNAP_FOLDER="${1%/}/$SNAP_FOLDER" + fi # Create $SNAP_FOLDER if it does not exist if [[ ! -d "$SNAP_FOLDER" ]]; then lib_print "?Creating snapshot folder because it does not yet exist [$SNAP_FOLDER]"