use PASSWORD_STORE_DIR env as fallback if present, otherwise use default value

This commit is contained in:
Rasmus Steinke 2015-08-21 16:01:31 +02:00
parent 72e9ed91f0
commit 6f575cfe1a

View File

@ -26,16 +26,16 @@ if [[ -z $BROWSER ]]; then
fi
# check if alternative root directory was given on commandline
if [[ -n "$2" && "$1" == "--root" ]]; then
root="${2}"
elif [[ $1 == "--last-used" ]]; then
if [[ $1 == "--last-used" ]]; then
root=$(awk -F ': ' '{ print $1 }' $HOME/.config/rofi-pass/last_used)
elif [[ -n "$2" && "$1" == "--root" ]]; then
root="${2}"
elif [[ -n $root ]]; then
root="${root}"
elif [[ -n ${PASSWORD_STORE_DIR} ]]; then
root=${PASSWORD_STORE_DIR}
else
if [[ -n $root ]]; then
root="${root}"
else
root="$HOME/.password-store"
fi
root="$HOME/.password-store"
fi
PASSWORD_STORE_DIR="${root}"