aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-02-03 00:08:08 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-02-03 00:08:08 +0100
commit6d2880e2bd95c87f49ca6110be9e0fdbca8078b3 (patch)
tree0a46a9461e7d213e82050c2694b413c652997911
parentfix(modules/lf/commands/trash_{clear,restore}): Don't start trash's interacti... (diff)
downloadnixos-config-6d2880e2bd95c87f49ca6110be9e0fdbca8078b3.zip
fix(modules/lf/commands/archive_decompress): Pipe the filenames not the file
Previously, we piped `$fx` directly into the shell, resulting in it opening the archive and interpreting it as the file name.
Diffstat (limited to '')
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/archive_decompress.sh24
1 files changed, 10 insertions, 14 deletions
diff --git a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh
index 0e99b98e..142ac4d2 100755
--- a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh
+++ b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh
@@ -11,19 +11,15 @@ id="$id"
set -f
-unarchive() {
- case "$1" in
- *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar --extract --bzip2 --verbose --file="$1" ;;
- *.tar.gz | *.tgz) tar --extract --gzip --verbose --file="$1" ;;
- *.tar.xz | *.txz) tar --extract --xz --verbose --file="$1" ;;
- *.tar*) tar --extract --verbose --file="$1" ;;
- *.zip) unzip "$1" ;;
- *.7z) 7z x "$1" ;;
- *) die "'$1' is not a supported file for unarchiving." ;;
+echo "$fx" | while read -r file; do
+ case "$file" in
+ *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar --extract --bzip2 --verbose --file="$file" ;;
+ *.tar.gz | *.tgz) tar --extract --gzip --verbose --file="$file" ;;
+ *.tar.xz | *.txz) tar --extract --xz --verbose --file="$file" ;;
+ *.tar*) tar --extract --verbose --file="$file" ;;
+ *.zip) unzip "$file" ;;
+ *.7z) 7z x "$file" ;;
+ *) die "'$file' is not a supported file for unarchiving." ;;
esac
-}
-
-while read -r file; do
- unarchive "$file"
-done <"$fx"
+done
# vim: ft=sh