Google provides Web definitions for any word by using the search query
define:WORD. We need a GUI web browser to fetch the definitions. However, we can automate it and parse the required definitions by using a script. Let's see how to do it.
We can use
grep to write the define utility.
Let's go through the code for the define utility script to fetch definitions from Google search:
#!/bin/bash #Filename: define.sh #Description: A Google define: frontend limit=0 if [ ! $# -ge 1 ]; then echo -e "Usage: $0 WORD [-n No_of_definitions]\n" exit -1; fi if [ "$2" = "-n" ]; then limit=$3; let limit++ fi word=$1 lynx -dump http://www.google.co.in/search?q=define:$word | \ awk ...