diff options
author | Brian Mattern <rephorm@rephorm.com> | 2013-05-20 09:44:33 -0700 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-05-22 13:46:55 +0200 |
commit | 0d9c02562ea5792fdf9691135a2b48f667a4c97d (patch) | |
tree | 2d091575aea52886a34468f4790906b23254f7ac | |
parent | 7797980519ad8938e8290503ce721ef5f194c01f (diff) | |
download | pass-0d9c02562ea5792fdf9691135a2b48f667a4c97d.tar.gz pass-0d9c02562ea5792fdf9691135a2b48f667a4c97d.tar.bz2 pass-0d9c02562ea5792fdf9691135a2b48f667a4c97d.zip |
check if a passfile exists before checking for directory
Diffstat (limited to '')
-rwxr-xr-x | src/password-store.sh | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/password-store.sh b/src/password-store.sh index d7b00b7..e080627 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -207,19 +207,8 @@ case "$command" in fi path="$1" - if [[ -d $PREFIX/$path ]]; then - if [[ -z $path ]]; then - echo "Password Store" - else - echo "${path%\/}" - fi - tree -l --noreport "$PREFIX/$path" | tail -n +2 | sed 's/\.gpg$//' - else - passfile="$PREFIX/$path.gpg" - if [[ ! -f $passfile ]]; then - echo "$path is not in the password store." - exit 1 - fi + passfile="$PREFIX/$path.gpg" + if [[ -f $passfile ]]; then if [[ $clip -eq 0 ]]; then exec gpg2 -d $GPG_OPTS "$passfile" else @@ -227,6 +216,16 @@ case "$command" in [[ -n $pass ]] || exit 1 clip "$pass" "$path" fi + elif [[ -d $PREFIX/$path ]]; then + if [[ -z $path ]]; then + echo "Password Store" + else + echo "${path%\/}" + fi + tree -l --noreport "$PREFIX/$path" | tail -n +2 | sed 's/\.gpg$//' + else + echo "$path is not in the password store." + exit 1 fi ;; insert) |