From a0d1a1f78c7b1a35b474ae9aec33e0220ab5168b Mon Sep 17 00:00:00 2001 From: Brett Milford Date: Fri, 9 Apr 2021 10:03:13 +1000 Subject: [PATCH] Update contrib/nuke-graph-directory.sh Signed-off-by: Brett Milford --- contrib/nuke-graph-directory.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/contrib/nuke-graph-directory.sh b/contrib/nuke-graph-directory.sh index 4b8581ecec..c0f807cd71 100755 --- a/contrib/nuke-graph-directory.sh +++ b/contrib/nuke-graph-directory.sh @@ -60,13 +60,11 @@ if command -v btrfs > /dev/null 2>&1; then # Find btrfs subvolumes under $dir checking for inode 256 # Source: http://stackoverflow.com/a/32865333 for subvol in $(find "$dir" -type d -inum 256 | sort -r); do - if [ "$dir" != "$subvol" ]; then - if [ "$(stat -f --format=%T $subvol)" == "btrfs" ]; then - ( - set -x - btrfs subvolume delete "$subvol" - ) - fi + if [ "$dir" != "$subvol" ] && subvolType="$(stat -f --format=%T "$subvol")" && [ "$subvolType" = "btrfs" ]; then + ( + set -x + btrfs subvolume delete "$subvol" + ) fi done fi