0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ワンライナーで牛がしゃべる時計を作る

Posted at

牛がしゃべるコマンドがある

cowsay というコマンドがあります。sl などと同じジョークコマンドで引数で渡した文字列をアスキーアートの牛の吹き出しに出力するというコマンドです。

インストールしてみる

### Debian系の場合
sudo apt install cowsay

### Redhat系の場合
sudo yum install cowsay

使ってみる

~$ cowsay hello
 _______
< hello >
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

ただこれだけです。

時計にする

cowsay の引数に時刻を渡せば当然時刻をしゃべってくれます

cowsay $(date +%H:%M:%S)

これを1秒に1回実行するようにします

while [ 1=1 ]; do cowsay $(date +%H:%M:%S); sleep 1 ;clear; done

結果が以下です
Screencast-from-2025-03-22-08-22-41.gif

最後に

昔から思っていたんですが、 cowsay で出力される動物って馬っぽくないですか?牛にはどうしても見えないです。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?