commit e646fdd9c797e1a1d625ae2dfcc22372a37b63e2
parent 62e703f5a71fcc2470aaac85c0ec39f4976cf914
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date: Fri, 5 Feb 2016 21:01:29 +0100
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?
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git 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