clean up code

This commit is contained in:
Guilherme Rugai Freire 2021-08-02 12:12:26 -03:00
parent b26330a3e9
commit df446b7401

View File

@ -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
else
exit 1
fi