Skip to content
David-Apps edited this page Dec 26, 2022 · 4 revisions

Dictionary lookup.

An easy, commandline tool to look up the definition of a word. Sample functions are based on merriam-webster.com, but can be tweaked for other online dictionaries. First, a simple bash wrapper to verify one argument, and then call edbrowse. Then, an edbrowse function to go to the website, and print the definition, or the spelling suggestions if you spelled it wrong.

#  mw lookup on a word, one arg
function mw() {
    if [ $# != 1 ]
    then
        echo "usage: mw word"
        return
    fi
    edbrowse "+<mw "
}

# I don't need javascript for this
nojs = merriam-webster.com
function+mw {
# mw word lookup
    b http://www.merriam-webster.com/dictionary/~0
    /spelling suggestion/X
    if(?) {
        /^h1/X
    }
    /^$/X
    /./p
}