From 625774e2df3256b067c64d5b84b364a6c646e7f0 Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Sun, 17 Apr 2016 23:46:36 +0200 Subject: [PATCH] moz-sec-get.sh: correctly handle passwords with \ dash's echo will parse backslash-number as an octal character code --- moz-sec-get.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moz-sec-get.sh b/moz-sec-get.sh index 39cbe23..cdc1951 100755 --- a/moz-sec-get.sh +++ b/moz-sec-get.sh @@ -11,9 +11,9 @@ pass=$( test -n "$2" \ || secret-tool lookup hostname "$host") if [ -z "$DISPLAY" ]; then - echo "$pass" + printf "%s\n" "$pass" else - echo "$pass" | xclip -selection clipboard + printf "%s" "$pass" | xclip -selection clipboard { sleep 16; echo "" | xclip -selection clipboard; } & echo >&2 "copied to clipboard; will clear it after 16s" fi