LoginSignup
10
10

More than 5 years have passed since last update.

Terminal 上で Google 検索と ALC 検索を行う

Posted at

ここでは、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 キーワード

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10