diff options
author | Jan Krautmacher <jan.krautmacher@indurad.com> | 2025-09-25 07:19:35 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2025-09-25 07:35:06 +0200 |
commit | 39d0ae37cbd478cab605397e99e468768825f764 (patch) | |
tree | 9987832d8a98d2c3e420e2ad90381ef7dcd322cf /posix-shell/utils.sh | |
parent | b3544be5fc0e47e85dbddc3242877f075d1d53be (diff) | |
download | dotfiles-39d0ae37cbd478cab605397e99e468768825f764.tar dotfiles-39d0ae37cbd478cab605397e99e468768825f764.tar.zst dotfiles-39d0ae37cbd478cab605397e99e468768825f764.zip |
posix-shell: utils: Add `lar()`
The `lar` (list archive) function is a utility to quickly inspect an
archive file.
Diffstat (limited to 'posix-shell/utils.sh')
-rw-r--r-- | posix-shell/utils.sh | 15 |
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" +} |