pash: Don't use here strings

This commit is contained in:
Dylan Araps 2019-11-14 15:47:59 +00:00
parent 422bd21ded
commit aa5a95bfc8
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 4 additions and 4 deletions

8
pash
View File

@ -20,14 +20,14 @@ pw_add() {
[[ $PASH_KEYID ]] && [[ $PASH_KEYID ]] &&
flags=(--trust-model always -aer "$PASH_KEYID") flags=(--trust-model always -aer "$PASH_KEYID")
GPG_TTY=$(tty) "${gpg[0]}" "${flags[@]:--c}" -o "$1.gpg" <<< "$pass" echo "$pass" | GPG_TTY=$(tty) "${gpg[0]}" "${flags[@]:--c}" -o "$1.gpg"
} }
pw_del() { pw_del() {
yn "Delete pass file '$1'?" yn "Delete pass file '$1'?"
[[ $REPLY == [yY] ]] && { [[ $REPLY == [yY] ]] && {
rm "$1.gpg" rm -f "$1.gpg"
rmdir -p "${1%/*}" 2>/dev/null rmdir -p "${1%/*}" 2>/dev/null
} }
} }
@ -45,7 +45,7 @@ pw_copy() {
if [[ $TMUX ]]; then if [[ $TMUX ]]; then
tmux load-buffer "$pass" tmux load-buffer "$pass"
else else
hash xclip && xclip -selection clipboard <<< "$pass" hash xclip && echo "$pass" | xclip -selection clipboard
fi fi
} }
@ -112,7 +112,7 @@ main() {
[[ $1 == [cds]* && ! -f $2.gpg ]] && [[ $1 == [cds]* && ! -f $2.gpg ]] &&
die "Pass file '$2' doesn't exist." die "Pass file '$2' doesn't exist."
[[ $1 == [a]* && -f $2.gpg ]] && [[ $1 == a* && -f $2.gpg ]] &&
die "Pass file '$2' already exists." die "Pass file '$2' already exists."
[[ $2 == */* && $2 == *../* ]] && [[ $2 == */* && $2 == *../* ]] &&