-
-
Save youpy/8120784 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# src: http://taka.no32.tk/diary/20050826.html | |
set -e | |
KEY=`echo $@ | nkf -w -w80 | sed 's/ /+/g'` | |
URI="https://eow.alc.co.jp/search?q=$KEY" | |
CONTENT=`curl -s -e='http://eow.alc.co.jp/' \ | |
-A 'Mozilla/5.0' "$URI" | \ | |
sed -ne '/<ul/,/<\/ul>/p' | grep -v '<li[^>]*><a ' | grep -v '"tango"' | w3m -dump -T 'text/html'` | |
if [ -n "$(echo "$CONTENT" | grep "$@$")" ]; then | |
echo $@ >> ~/.eng-list # 履歴を保存(不要なら削除). | |
echo "$CONTENT" | less -c | |
else | |
echo "Not Found" >&2 | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# requires gsort and tw | |
# | |
# $ brew install coreutils | |
# $ gem install tw | |
cat ~/.eng-list \ | |
| sort \ | |
| uniq \ | |
| gsort --random-sort \ | |
| head -1 \ | |
| xargs -I{} ej {} \ | |
| tr '\n' ' ' \ | |
| sed 's/ \{2,\}/ /g' \ | |
| sed 's/{[^}]*}//g' \ | |
| cut -c -140 \ | |
| tw --pipe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment