ここでは、Terminal 上で使用している Shell を zsh として話を進めます。OS は Ubuntu です。
テキストブラウザ w3m の Install
Terminal
sudo apt-get install -y w3m
vi ~/.zshrc
設定ファイルに以下を追記します。
~/.zshrc
# w3mでgoogle検索
function google() {
local str opt
if [ $ != 0 ]; then
for i in $*; do
str="$str+$i"
done
str=`echo $str | sed 's/^\+//'`
opt='search?num=50&hl=ja&lr=lang_ja'
opt="${opt}&q=${str}"
fi
w3m http://www.google.co.jp/$opt
}
# w3mでALC検索
function alc() {
if [ $ != 0 ]; then
w3m "http://eow.alc.co.jp/$*/UTF-8/?ref=sa"
else
w3m "http://www.alc.co.jp/"
fi
}
検索
あとは、Terminal 上で以下の様なコマンドを用いれば、w3m が起動し、キーワードを検索してくれます。
$ google キーワード
$ alc キーワード