aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2016-04-10 11:51:35 +0200
committerRasmus Steinke <rasi@xssn.at>2016-04-10 11:51:35 +0200
commit42a3cfff05e2db582ec8d6b0917981e10bb6c15b (patch)
tree2973713fbcaeef042db1d4916a4408d786c7bcc0
parent75cf7151588927122d696dc1daa95fee1ba43644 (diff)
parentc8e49102b2faad6102ea4e9bc47444ce792a444d (diff)
downloadrofi-pass-42a3cfff05e2db582ec8d6b0917981e10bb6c15b.tar.gz
Merge pull request #35 from x4121/master
Check if /tmp/$USER-rofi-pass/last_used exists
-rwxr-xr-xrofi-pass13
1 files changed, 10 insertions, 3 deletions
diff --git a/rofi-pass b/rofi-pass
index 5edbbc2..51d3023 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -513,7 +513,7 @@ if [[ -z ${count} ]]; then
fi
# check if alternative root directory was given on commandline
-if [[ $1 == "--last-used" || $1 == "--show-last" ]]; then
+if [[ -r "/tmp/$USER-rofi-pass/last_used" ]] && [[ $1 == "--last-used" || $1 == "--show-last" ]]; then
export root=$(awk -F ': ' '{ print $1 }' /tmp/$USER-rofi-pass/last_used)
elif [[ -n "$2" && "$1" == "--root" ]]; then
export root="${2}"
@@ -539,10 +539,17 @@ export PASSWORD_STORE_DIR="${root}"
help_msg
;;
--last-used)
- entry="$(awk -F ': ' '{ print $2 }' /tmp/$USER-rofi-pass/last_used)" mainMenu
+ if [[ -r "/tmp/$USER-rofi-pass/last_used" ]]; then
+ entry="$(awk -F ': ' '{ print $2 }' /tmp/$USER-rofi-pass/last_used)"
+ fi
+ mainMenu
;;
--show-last)
- selected_password="$(awk -F ': ' '{ print $2 }' /tmp/$USER-rofi-pass/last_used)" showEntry
+ if [[ -r "/tmp/$USER-rofi-pass/last_used" ]]; then
+ selected_password="$(awk -F ': ' '{ print $2 }' /tmp/$USER-rofi-pass/last_used)" showEntry
+ else
+ mainMenu
+ fi
;;
--bmarks)
mainMenu --bmarks;