Skip to content

Instantly share code, notes, and snippets.

@juanirming
Created February 4, 2019 09:44
Show Gist options
  • Save juanirming/cc594818e5bf2d7c99a040d9cd822117 to your computer and use it in GitHub Desktop.
Save juanirming/cc594818e5bf2d7c99a040d9cd822117 to your computer and use it in GitHub Desktop.
Search Google and Wikipedia from bash command line
#!/usr/bin/env bash
################################################################################
# bash_web_search.sh
#
# The functions below can be included in .bashrc (or other start-up file) to
# provide the ability to perform Google (via Startpage) and Wikipedia searches
# directly from the command line using the commands se and wi.
#
# Examples: se are cats smarter than dogs
# wi felis catus
#
# Dependencies: elinks
#
# Author: Juan Irming
function se() {
IFS='+'
elinks "https://www.startpage.com/do/search?query=$*"
}
function wi() {
IFS='_'
elinks "https://en.wikipedia.org/wiki/$*"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment