Created
April 13, 2019 06:36
-
-
Save katoozi/e620c25e8772df8b7c0e69afd06bc5a9 to your computer and use it in GitHub Desktop.
my google search script for dmenu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
browser=${BROWSER:-google-chrome-stable} | |
pgrep -x dmenu && exit | |
choice=$(echo "" | dmenu -i -p "Search Google:") || exit 1 | |
if [ "$choice" = "" ]; then | |
$browser "https://google.com" | |
else | |
if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then | |
$browser "$choice" | |
else | |
$browser "https://google.com/search?q=$choice" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment