はじめに

コマンドライン上でバナーを表示するコマンドがあるとのことで使ってみる。

環境

1
2
Mac OS Sonoma 14.4.1
Homebrew 4.2.15

bannerのインストール

既に入っていたので割愛。
(※古くから存在しているコマンドっぽいので大体入っていると思われる。)
calコマンドと同じで、古くからあるようだ。

bannerを使う

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
banner 
Message: a
                                          ######## 
                                      ################ 
                                    #################### 
                                  ########################             ##### 
                                 ##########################          ########## 
                                ############################        ############# 
                               ##############################       ############## 
                               #########            #########       ############### 
                              ########                ########       ############## 
                              #######                  #######         ####   ###### 
                              ######                    ######                 ##### 
                              ######                    ######                  #### 
                              ######                    ######                  #### 
                               #####                    #####                   #### 
                               #####                    #####                  ##### 
                                #####                  #####                  ###### 
                                 #####                #####                  ####### 
                                  ######            ######                ######### 
                                   ################################################ 
                                 ################################################# 
                                ################################################# 
                               ################################################# 
                              ################################################# 
                              ############################################### 
                              ############################################# 
                              ######################################### 
                              ###### 
                              #### 
                              ### 
                              ## 
                                 

こんな感じでCLI上で文字を表示してくれる。

幅を変えてみる

-wで幅を変えられる。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
banner -w 50 
Message: a
                ### 
              ########
             ##########   ##### 
            ####    ####  ######
            ##        ##      ## 
            ##        ##       # 
             ##      ##       ## 
              ##################
            ###################
            ##################
            ## 
            #

※デフォルトは132らしい?

manを見てみる

manで見てみると、History欄に A cal command appeared in Version 6 AT&T UNIX. とあるので、かなり古くからあるみたいだ。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$man banner   

BANNER(6)                                                            Games Manual                                                            BANNER(6)
 
NAME
     banner – print large banner on printer
 
SYNOPSIS
     banner [-d] [-t] [-w width] message ...
 
DESCRIPTION
     Banner prints a large, high quality banner on the standard output.  If the message is omitted, it prompts for and reads one line of its standard
     input.
 
     The output should be printed on paper of the appropriate width, with no breaks between the pages.
 
     The following options are available:
 
     -d      Enable debug.
 
     -t      Enable trace.
 
     -w width
             Change the output from a width of 132 to width, suitable for a narrow terminal.
 
HISTORY
     The banner utility first appeared in AT&T UNIX 6.
 
AUTHORS
     Mark Horton
 
BUGS
     Several ASCII characters are not defined, notably <, >, [, ], \, ^, _, {, }, |, and ~.  Also, the characters ", ', and & are funny looking (but
     in a useful way.)
 
     The -w option is implemented by skipping some rows and columns.  The smaller it gets, the grainier the output.  Sometimes it runs letters
     together.
 
     Messages are limited to 1024 characters in length.
 
macOS 14.4                                                           June 21, 2021                                                          macOS 14.4

参考

おわりに

使う機会はあまりないだろうけど、面白いコマンドがあると癒される。
ディストリビューションによるが、SSHログイン時に表示されるバナーメッセージも中身はこれなのかな。