etc~ scripts and random things |
| git clone https://github.com/djnnvx/etc.git |
| log | files | refs | archive |
goog (405B)
1 #!/usr/bin/env bash 2 3 set -eo pipefail 4 5 SEARCH_URL="https://www.google.com/search?q=" 6 7 # Check if a browser is set, otherwise default to firefox 8 if [[ -z "$BROWSER" ]]; then 9 BROWSER="firefox" 10 fi 11 12 # use printf to handle arguments with spaces and join them with '+' 13 QUERY=$(printf '%s+' "$@") 14 QUERY=${QUERY%+} # Remove the trailing '+' 15 16 FULL_URL="${SEARCH_URL}${QUERY}" 17 bash -c "${BROWSER} ${FULL_URL}"