10
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

働いている振りをサポートするイカれたツールを紹介するぜ!

Last updated at Posted at 2017-04-29

前書き

w3m!

以上だ!

検証環境

Debian8.6(64bit)

w3m(ページャ/テキストベースWWWブラウザ)

w3m(WWW-wo-Miru)は、日本人が作成したテキストベースWebブラウザです。
その特徴は端末上でWeb検索作業できる事であり、この点はマウス無しで調査作業ができる事を意味します。
しかし、使いづらい部分が多々あったため、それらを補うスクリプトを本記事に記載しています。

インストール方法

$ sudo apt-get install w3m
$ sudo apt-get install w3m-img   (注釈)端末上で画像を表示したい場合はインストールする。

起動画面

[起動書式]

w3m <URL>

[例]

w3m http://google.com

Screenshot from 2017-04-29 12:34:54.png

スクリプトによる起動簡略化

w3mの使いづらい点の一つに、起動時にURLを記入しなければいけない事が挙げられます。
そこで、以下のスクリプトを用いれば、ggle [検索ワード(複数可、スペース区切り)]で検索ができます。

ggle.
# !/bin/bash
# @(#) google to change argument of w3m command from URL to search word.
#
# Description : 
# Author : Nao1215
# Since  : 2017.04.29 ver 1.0.0
#
ARGS=""
ARG=""

function showUsage() {
    cat <<_EOT_
  Usage:
    ./google <search word>
  Description:
    Read this script
  Options:
    -h|--help : show usage.
_EOT_
exit 1
}

# Check args
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
    showUsage
fi

# Connect arguments as character string
for ARG in "$@"
do
    ARGS="${ARGS}+${ARG}"
done
ARGS=$(echo ${ARGS} | sed 's/^\+//')

# Start web searching
w3m http://www.google.co.jp/search?q="${ARGS}"       

インストール手順および使用方法は、以下の通りです。

$ git clone https://github.com/nao1215/BashScriptsCompilation.git -b master
$ cd BashScriptsCompilation
$ sudo ./installScripts

$ ggle ゴールデンウィーク

Screenshot from 2017-04-29 13:34:55.png

最後に

眠れなくて、カッとなって書いた。反省はしている。

10
18
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
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?