[pass] [passmenu]: Complicated way for first line?

Jason A. Donenfeld Jason at zx2c4.com
Fri Feb 5 22:21:49 CET 2016


Merging this just for you. :-P

commit e646fdd9c797e1a1d625ae2dfcc22372a37b63e2
Author: Jason A. Donenfeld <Jason at zx2c4.com>
Date:   Fri Feb 5 21:01:29 2016 +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?

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



-- 
Jason A. Donenfeld
Deep Space Explorer
fr: +33 6 51 90 82 66
us: +1 513 476 1200
www.jasondonenfeld.com
www.zx2c4.com
zx2c4.com/keys/AB9942E6D4A4CFC3412620A749FC7012A5DE03AE.asc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20160205/3c1c308c/attachment.html>


More information about the Password-Store mailing list