view bin/google @ 1593:09fd7f98c5f8

<elliott> echo "#!/bin/sh" >bin/seen; echo \'cd /var/irclogs/_esoteric\' >>bin/seen; echo \'for file in $(ls -r | grep "....-..-..\\.txt"); do grep -P -i "^..:..:..: <$1>" $file; done | tail -n 1\' >>bin/seen; chmod +x bin/seen
author HackBot
date Tue, 22 Jan 2013 00:07:42 +0000
parents e037173e0012
children
line wrap: on
line source

#!/bin/bash
if [ ! "$1" ]
then
    echo 'Google what?'
    exit 1
fi

QUERY=`echo -n "$1" | od -t x1 -A n -w1000 | tr " " %`

lynx --cfg=/dev/null --lss=/dev/null \
     --dump --width=1000 'http://google.com/search?q='"$QUERY" |
    grep -A 4 'Search Results' |
    tail -n 2