From a3473c8820146636f49a2103c5f8a0288a677e45 Mon Sep 17 00:00:00 2001 From: Marco Raber Date: Wed, 26 Aug 2020 10:38:56 +0200 Subject: [PATCH] added control for when bw finds nothing --- bwSearch | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bwSearch b/bwSearch index d106757..ea8c3bb 100755 --- a/bwSearch +++ b/bwSearch @@ -1,5 +1,7 @@ #!/bin/bash -export BW_SESSION = your token here +# export BW_SESSION = your token here +export BW_SESSION="your token here" + [[ $# -eq 0 ]] && query=$(echo -e "\n" | dmenu -p "What to search:") || query=$@ # the query is passed through parameters, if not it's asked through a text-box @@ -10,6 +12,7 @@ passwords="" json=$(bw list items --search $query) length=$(echo $json | jq -r 'length') #how many accounts found for that site +[[ $length -eq 0 ]] && notify-send Error "No entry found, retry with a different query" && exit for row in $(echo "${json}" | jq -r '.[] | @base64'); do _jq() { #this function is used to loop through the multiple results echo ${row} | base64 --decode | jq -r ${1}