We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent adac03b commit 4edbba3Copy full SHA for 4edbba3
1 file changed
lazylosad.sh
@@ -59,6 +59,17 @@ echo "⬇️ Downloading $choice..."
59
curl -#L -o "$archive" "$url"
60
61
echo "📦 Unpacking to $(pwd)..."
62
-unzip -oq "$archive" -d .
+unzip -oq "$archive" -d "$tmpdir/unzip"
63
+
64
+first_item=$(find "$tmpdir/unzip" -mindepth 1 -maxdepth 1 | head -n 1)
65
+dir_count=$(find "$tmpdir/unzip" -mindepth 1 -maxdepth 1 -type d | wc -l)
66
67
+shopt -s dotglob
68
+if [[ -d "$first_item" && $dir_count -eq 1 ]]; then
69
+ mv "$first_item"/* .
70
+else
71
+ mv "$tmpdir/unzip"/* .
72
+fi
73
+shopt -u dotglob
74
75
echo "🎉 Done!"
0 commit comments