commit 838d4b35482a3a4dd7ba10097017da00d4221280
parent 97e4b65db3e2199f3564968bf54094cc9bf675eb
Author: hhvn <dev@hhvn.uk>
Date: Sat, 17 Apr 2021 23:07:52 +0100
.s/b/mpvms .s/b/passgpg .s/b/passgpg2: use "$@"
"$@" has special meaning, it expands to "$1" "$2", etc.
I didn't know that until today so had an ugly system that
worked a bit better than just $@ atleast :)
Diffstat:
3 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/.scripts/bin/mpvms b/.scripts/bin/mpvms
@@ -5,18 +5,9 @@
shift
hmpv pause /tmp/mpv-socket
herbe "Playing video(s): $@" &
- while [ $# -ne 0 ]
- do
- printf "%s\0" "$1"
- shift
- done | xargs -0 mpv --input-ipc-server=/tmp/mpv-socket2 -- || herbe "Failed to play video(s): $@"
+ mpv --input-ipc-server=/tmp/mpv-socket2 -- "$@" || herbe "Failed to play video(s): $@"
exit
} || {
herbe "Playing music: $@" &
- while [ $# -ne 0 ]
- do
- printf "%s\0" "$1"
- shift
- done | xargs -0 mpv --input-ipc-server=/tmp/mpv-socket --no-video -- || herbe "Failed to play music: $@"
- exit
+ mpv --input-ipc-server=/tmp/mpv-socket --no-video -- "$@" || herbe "Failed to play music: $@"
}
diff --git a/.scripts/bin/passgpg b/.scripts/bin/passgpg
@@ -1,7 +1,3 @@
#!/bin/sh
-while [ $# != 0 ]
-do
- printf '%s\0' "$1"
- shift
-done | xargs -0 gpg --armour --passphrase "$(dpass gpg3key)"
+gpg --armour --passphrase "$(dpass gpg3key)" "$@"
diff --git a/.scripts/bin/passgpg2 b/.scripts/bin/passgpg2
@@ -2,8 +2,4 @@
# gpg2 is so stupid, use gpg1 if you have the chance
# why do I need --batch and --pinentry-mode loopback just so --passphrase works? wtf?
-while [ $# != 0 ]
-do
- printf '%s\0' "$1"
- shift
-done | xargs -0 gpg2 --armour --batch --pinentry-mode loopback --passphrase "$(dpass gpg3key)"
+gpg2 --armour --batch --pinentry-mode loopback --passphrase "$(dpass gpg3key)" "$@"