m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-02-05 21:01:29 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-02-05 21:01:29 +0100
commite646fdd9c797e1a1d625ae2dfcc22372a37b63e2 (patch)
tree2e39b82627f5e311e0cd705db39c8bb0c4810180
parent62e703f5a71fcc2470aaac85c0ec39f4976cf914 (diff)
passmenu: don't use awk
Prof. Aho always seemed neat, but parsing a script inside a script for the simple purpose of removing the trailing new line seems a bit absurd. So, instead use two processes! One for getting the first line and one for removing the trailing line. Everybody loves more calls to fork(), right?
-rwxr-xr-xcontrib/dmenu/passmenu3
1 files changed, 1 insertions, 2 deletions
diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu
index 9b5239d..c89d9b9 100755
--- a/contrib/dmenu/passmenu
+++ b/contrib/dmenu/passmenu
@@ -20,7 +20,6 @@ password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
if [[ $typeit -eq 0 ]]; then
pass show -c "$password" 2>/dev/null
else
- pass show "$password" |
- awk 'BEGIN{ORS=""} {print; exit}' |
+ pass show "$password" | head -n 1 | tr -d '\n\r' |
xdotool type --clearmodifiers --file -
fi