Commit: 4721d9bf1696ff11d13a86244f44dabac9fb0a0c
Parent: c9283bd92f54225ac6e1686a355971945dfaf903
Author: Randy Palamar
Date: Sun, 5 Nov 2023 14:59:21 -0700
unpack: mkdir -p; the correct way to handle existing dirs
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/unpack b/bin/unpack
@@ -23,7 +23,7 @@ case "$#" in
esac
[ -f "$1" ] || die "unpack: $1: not a regular file"
-[ -d "$2" ] || mkdir "$2" >/dev/null 2>&1 || die "unpack: $2: not a directory"
+mkdir -p "$2" >/dev/null 2>&1 || die "unpack: $2: not a directory"
case $(file -ib -- "$1" | cut -d ';' -f 1 | cut -d '/' -f 2) in
bzip2|x-bzip2) run bzip2 -dc "$1" | tar -C "$2" -x ;;