Skip to content

Instantly share code, notes, and snippets.

@minimul
Created February 8, 2020 14:19
Show Gist options
  • Save minimul/5d666e7d9d648b7d2b01f55fbf93231f to your computer and use it in GitHub Desktop.
Save minimul/5d666e7d9d648b7d2b01f55fbf93231f to your computer and use it in GitHub Desktop.
Elinks smart URL for w3m in bash functions
function go-base {
url=$1
echo $url
shift
args=$@
params="$(ruby -r cgi -e 'puts CGI.escape(ARGV[0])' "$args")"
url=$(printf $url "$params")
cmd="w3m \"$url\""
eval $cmd
}
function go-th {
go-base "https://words.bighugelabs.com/%s" $@
}
function go-l {
go-base "https://www.google.com/search?btnI&q=%s" $@
}
function go-g {
go-base "https://www.google.com/search?q=%s" $@
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment