From 4a01477359e1b65aa449c268e116ff85b2a7b208 Mon Sep 17 00:00:00 2001 From: Matthias Weigand Date: Tue, 25 Aug 2020 09:21:31 +0200 Subject: [PATCH] Exit out of search when no url has been selected When exiting the $url dmenu prompt with e.g. , one would be prompted with the search dmenu anyways. This addition checks whether the second dmenu is even necessary. --- sch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sch b/sch index c338214..e889106 100755 --- a/sch +++ b/sch @@ -3,6 +3,10 @@ # To avoid issues with spaces and special characters html encoding is applied to the query url=$(sort ~/.config/search/search | sed 's/:.*//' | dmenu -i -p "Search Engine" | xargs -I % grep "%:" ~/.config/search/search | sed 's/.*://') + +# exit if no url was selected +[ -z $url ] && exit 0 + search=$(sort ~/.config/search/search_history | dmenu -i -p "Search") # Echo to history file