From df446b740158484fcabe6c281ee2d29c86fc774d Mon Sep 17 00:00:00 2001 From: Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com> Date: Mon, 2 Aug 2021 12:12:26 -0300 Subject: [PATCH] clean up code --- firefox-quick-keywords/firefox-quick-keywords | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/firefox-quick-keywords/firefox-quick-keywords b/firefox-quick-keywords/firefox-quick-keywords index ceb1c25..a48de39 100755 --- a/firefox-quick-keywords/firefox-quick-keywords +++ b/firefox-quick-keywords/firefox-quick-keywords @@ -1,12 +1,12 @@ -#!/usr/bin/env bash +#!/bin/sh -if [[ $(command -v rofi) ]]; then +if [ "$(command -v rofi)" ]; then CMD='rofi -dmenu'; -elif [[ $(command -v dmenu) ]]; then +elif [ "$(command -v dmenu)" ]; then CMD='dmenu'; else echo 'Could not find either dmenu or rofi, exiting' - exit 0; + exit 1; fi @@ -25,10 +25,11 @@ rm $DB CHOICE=$(echo "$OPTIONS" | $CMD -p "Firefox quick open:") # Check choice -URL=$(echo "$CHOICE" | awk '{print $NF}') || exit 0 +URL=$(echo "$CHOICE" | awk '{print $NF}') || exit 1 VALID=$(echo "$OPTIONS" | grep "$URL") if [ -n "$VALID" ] && [ -n "$CHOICE" ]; then - firefox $URL -else + firefox "$URL" exit 0 -fi \ No newline at end of file +else + exit 1 +fi