3
2

More than 3 years have passed since last update.

真面目に sl をCentOS7へインストールしてみた

Posted at

sl コマンドとは

sl って何?って人は回れ右。
あなたのスキルをわずかも向上させることはありません。

作成者曰く、
SL(1): 究極の冗談コマンド

ということです。
最終更新が、
2017/4/20
になっているので、それなりにメンテナンスはされているのかも。

CentOS7 にインストールしてみた

ソースの取得

公式URLがあるのでそこから。
https://github.com/mtoyoda/sl

[root@localhost ~]# wget ftp://ftp.linet.gr.jp/pub/Plamo/Plamo-2.1/contrib/Texttools/sl.tgz

別にwgetじゃなくてもなんでもよい。楽な方法で。
んで、適当な場所で解凍する

[root@localhost ~]# unzip -q sl.tgz
[root@localhost ~]# cd sl-master
[root@localhost sl-master]# ls -l
合計 696
-rw-r--r-- 1 root root    334  4月 20  2017 LICENSE
-rw-r--r-- 1 root root    358  4月 20  2017 Makefile
-rw-r--r-- 1 root root    436  4月 20  2017 README.ja.md
-rw-r--r-- 1 root root    297  4月 20  2017 README.md
-rw-r--r-- 1 root root 666742  4月 20  2017 demo.gif
-rw-r--r-- 1 root root    593  4月 20  2017 sl.1
-rw-r--r-- 1 root root    764  4月 20  2017 sl.1.ja
-rw-r--r-- 1 root root  10703  4月 20  2017 sl.c
-rw-r--r-- 1 root root   6627  4月 20  2017 sl.h

解凍したファイルの中身見ると、Makeしてインストールするようになっている。
Makeするための gcc がサーバには入ってなかったので入れる。

[root@localhost sl-master]# yum install gcc
...
Is this ok [y/d/N]: y
...
インストール:
  gcc.x86_64 0:4.8.5-39.el7

依存性関連をインストールしました:
  cpp.x86_64 0:4.8.5-39.el7        glibc-devel.x86_64 0:2.17-292.el7        glibc-headers.x86_64 0:2.17-292.el7

完了しました!
[root@localhost sl-master]# make all
gcc -O -Wall -o sl sl.c -lncurses
sl.c:41:20: 致命的エラー: curses.h: そのようなファイルやディレクトリはありません
 #include <curses.h>
                    ^
コンパイルを停止しました。
make: *** [sl] エラー 1

ムムム。

curses.h
のライブラリがないっぽい。

[root@localhost sl-master]# yum provides \*/curses.h
...
ncurses-devel-5.9-14.20130511.el7_4.x86_64 : Development files for the ncurses library
リポジトリー        : base
一致          :
ファイル名    : /usr/include/ncurses/curses.h
ファイル名    : /usr/include/ncursesw/curses.h
ファイル名    : /usr/include/curses.h

ncurses-devel-5.9-14.20130511.el7_4.x86_64
がないようなので入れる。

[root@localhost sl-master]# yum install ncurses-devel-5.9-14.20130511.el7_4.x86_64
...
Is this ok [y/d/N]: y
...
  インストール中          : ncurses-devel-5.9-14.20130511.el7_4.x86_64                                            1/1
  検証中                  : ncurses-devel-5.9-14.20130511.el7_4.x86_64                                            1/1

インストール:
  ncurses-devel.x86_64 0:5.9-14.20130511.el7_4

完了しました!

もう一度、

[root@localhost sl-master]# make all
gcc -O -Wall -o sl sl.c -lncurses
[root@localhost sl-master]# 

通った。

[root@localhost sl-master]# ls -l
合計 716
-rw-r--r-- 1 root root    334  4月 20  2017 LICENSE
-rw-r--r-- 1 root root    358  4月 20  2017 Makefile
-rw-r--r-- 1 root root    436  4月 20  2017 README.ja.md
-rw-r--r-- 1 root root    297  4月 20  2017 README.md
-rw-r--r-- 1 root root 666742  4月 20  2017 demo.gif
-rwxr-xr-x 1 root root  17976 11 17 16:32 sl
-rw-r--r-- 1 root root    593  4月 20  2017 sl.1
-rw-r--r-- 1 root root    764  4月 20  2017 sl.1.ja
-rw-r--r-- 1 root root  10703  4月 20  2017 sl.c
-rw-r--r-- 1 root root   6627  4月 20  2017 sl.h

-rwxr-xr-x 1 root root 17976 11月 17 16:32 sl
実行ファイル出来上がり。

適当にPATHが通る場所へ

[root@localhost sl-master]# cp -pi ./sl /usr/local/bin/
[root@localhost sl-master]# which sl
/usr/local/bin/sl

これでもし ls と sl を打ち間違ったときには汽車が走ります。
うざくなること請け合い。

参照
豊田正史とslコマンド (Masashi Toyoda and SL command) ※作者
SL改造計画
ジョークプログラムslを動かしてみた

実行したら……

楽しみを奪ってしまう?かもしれないですが、
こんな感じになります。

sl

sl.gif

sl -a

sl-a.gif

sl -c

sl-c.gif

sl -F

sl-F.gif

sl -l

sl-l.gif

sl -alFc

実際に試して見てみてね。

3
2
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
3
2