summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-09-25 07:19:35 +0200
committerxengineering <me@xengineering.eu>2025-09-25 07:35:06 +0200
commit724d4195741a5ea9fcdd63dc4fb2b51498b0770c (patch)
tree9987832d8a98d2c3e420e2ad90381ef7dcd322cf
parent83a33610984019e7b06f41af556751398aadeb39 (diff)
downloaddotfiles-724d4195741a5ea9fcdd63dc4fb2b51498b0770c.tar
dotfiles-724d4195741a5ea9fcdd63dc4fb2b51498b0770c.tar.zst
dotfiles-724d4195741a5ea9fcdd63dc4fb2b51498b0770c.zip
posix-shell: utils: Add `lar()`
The `lar` (list archive) function is a utility to quickly inspect an archive file.
-rw-r--r--posix-shell/utils.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/posix-shell/utils.sh b/posix-shell/utils.sh
index f19602d..4354a37 100644
--- a/posix-shell/utils.sh
+++ b/posix-shell/utils.sh
@@ -243,3 +243,18 @@ hexdiff() {
rm -f "$dump1" "$dump2"
}
+
+lar() {
+ if test "$#" -ne 1
+ then
+ echo "Usage: lar <archive-file>"
+ return 1
+ fi
+
+ temporary_directory="$(mktemp -d)"
+ tar -xf "$1" -C "$temporary_directory"
+ pushd "$temporary_directory"
+ lf
+ popd
+ rm -rf "$temporary_directory"
+}