diff options
Diffstat (limited to '.uzbl/scripts/url_from_surfraw.sh')
-rwxr-xr-x | .uzbl/scripts/url_from_surfraw.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.uzbl/scripts/url_from_surfraw.sh b/.uzbl/scripts/url_from_surfraw.sh new file mode 100755 index 0000000..bf3c501 --- /dev/null +++ b/.uzbl/scripts/url_from_surfraw.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +DEFAULT_SEARCH=startpage +string=$1 +cmd=$2 +set -- $string +is_elvi=$(surfraw -elvi | grep -c "^$1\s") +nbr_words=$(echo "$string" | wc -w) +if [ "$nbr_words" -eq 1 ] && [ "$is_elvi" -eq 0 ] && ([[ "$string" == *.* ]] || [[ "$string" == *:* ]]) +then + url="$1" +elif [ $is_elvi -eq 1 ] +then + url="$(surfraw -print $string)" +else + url="$(surfraw -print $DEFAULT_SEARCH $string)" +fi +echo "$cmd $url" > $UZBL_FIFO |