summaryrefslogtreecommitdiff
path: root/posix-shell
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-07-26 10:58:52 +0200
committerxengineering <me@xengineering.eu>2025-07-26 10:58:52 +0200
commit9d31df9faf24fdecd3b1d07ee04bca09a9ce7555 (patch)
tree2b622403374fd2c0fb6ba79a083ef8618bc4d6af /posix-shell
parentd702c0d54e2a64a2ebfe6492533095c869bf049a (diff)
downloaddotfiles-9d31df9faf24fdecd3b1d07ee04bca09a9ce7555.tar
dotfiles-9d31df9faf24fdecd3b1d07ee04bca09a9ce7555.tar.zst
dotfiles-9d31df9faf24fdecd3b1d07ee04bca09a9ce7555.zip
posix-shell: utils: Add `lar()`
The list archive (`lar`) util creates a temporary directory, unpacks the given tar archive into it, switches to that folder, starts the terminal file manager `lf` and on quit jumps back and deletes the temporary directory. This is useful to quickly inspect the contents of a tar archive.
Diffstat (limited to 'posix-shell')
-rw-r--r--posix-shell/utils.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/posix-shell/utils.sh b/posix-shell/utils.sh
index 596263e..b1ffc21 100644
--- a/posix-shell/utils.sh
+++ b/posix-shell/utils.sh
@@ -216,3 +216,12 @@ url() {
# open selected URL in browser
firefox "${url}"
}
+
+lar() {
+ temp="$(mktemp -d)"
+ tar -xf "$1" -C "$temp"
+ pushd "$temp"
+ lf
+ popd
+ rm -rf "$temp"
+}