summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-24 11:32:32 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-24 11:34:19 +0200
commit9d92e5bca1543be40270c288feb546df0382afee (patch)
tree9b0941cf4fd3a6b221397ea5bec6779e2d794d2b /src
parentbdc3bacff7e149933275fa4ecbc5644773ca12c5 (diff)
downloadpass-9d92e5bca1543be40270c288feb546df0382afee.tar.gz
pass-9d92e5bca1543be40270c288feb546df0382afee.tar.bz2
pass-9d92e5bca1543be40270c288feb546df0382afee.zip
Don't prompt for questions when stdin is not a tty.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/password-store.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 9e27763..657f0e5 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -35,6 +35,7 @@ git_commit() {
git commit $sign -m "$1"
}
yesno() {
+ [[ -t 0 ]] || return 0
local response
read -r -p "$1 [y/N] " response
[[ $response == [yY] ]] || exit 1
@@ -75,7 +76,7 @@ set_gpg_recipients() {
done < "$current"
}
agent_check() {
- [[ -n $GPG_AGENT_INFO ]] || yesno "$(cat <<-_EOF
+ [[ ! -t 0 || -n $GPG_AGENT_INFO ]] || yesno "$(cat <<-_EOF
You are not running gpg-agent. This means that you will
need to enter your password for each and every gpg file
that pass processes. This could be quite tedious.
@@ -559,7 +560,7 @@ cmd_copy_move() {
[[ -d $old_path || -d $new_path || $new_path =~ /$ ]] || new_path="${new_path}.gpg"
local interactive="-i"
- [[ $force -eq 1 ]] && interactive="-f"
+ [[ ! -t 0 || $force -eq 1 ]] && interactive="-f"
if [[ $move -eq 1 ]]; then
mv $interactive -v "$old_path" "$new_path" || exit 1