dont delete last_used when selection is empty

This commit is contained in:
Rasmus Steinke 2015-08-05 08:34:32 +02:00
parent e93d74fab6
commit 381902ec81

View File

@ -61,8 +61,10 @@ ${open_url}: Open URL | ${copy_name}: Copy Username | ${copy_pass}: Copy Passwor
selected_password="$(echo -e "[ Add Entry ]>\n[ Manage Database ]>\n---\n$(list_passwords 2>/dev/null)" | rofi -i -mesg "${HELP}" -dmenu -kb-custom-1 "${autotype}" -kb-custom-2 "${type_user}" -kb-custom-3 "${type_pass}" -kb-custom-4 "${open_url}" -kb-custom-5 "${copy_name}" -kb-custom-6 "${copy_pass}" -kb-custom-7 "${show}" -dmenu -select "$entry" -p "rofi-pass > ")"
rofi_exit=$?
rm -f "$HOME/.config/rofi-pass/last_used"
echo "$selected_password" > "$HOME/.config/rofi-pass/last_used"
if [[ -n $selected_password ]]; then
rm -f "$HOME/.config/rofi-pass/last_used"
echo "$selected_password" > "$HOME/.config/rofi-pass/last_used"
fi
if [[ "${rofi_exit}" -eq 13 ]]; then $BROWSER "$(pass "$selected_password" | grep "URL: " | awk -F 'URL: ' '{ print $2 }')"; exit;
elif [[ "${rofi_exit}" -eq 1 ]]; then exit ${rofi_exit};