Neil Kuan
June 29, 2020

More more more LoLBanner ~~

Posted on June 29, 2020  •  1 minutes  • 139 words

前言: 我的環境是 mac os 如果是其他系統 裝起來應該大同小異 可以參考 https://www.tecmint.com/lolcat-command-to-output-rainbow-of-colors-in-linux-terminal/

lolcat is a ruby gem hence it is essential to have latest version of RUBY installed on your system.

首先利用 brew 安裝 必要的套件

沒有 homebrew 請先安裝 ckick here

# 如果沒有 ruby 請先安裝 ruby 
$ brew install ruby
$ brew install figlet
$ brew install lolcat

創建front 資料夾,並進入

$ mkdir -p ~/.local/share/fonts/figlet-fonts/
$ cd ~/.local/share/fonts/figlet-fonts

https://github.com/xero/figlet-fonts 選取你想要的 主題,我選的是 3d.flf

下載 文字格式

$ cd ~/.local/share/fonts/figlet-fonts
$ wget https://raw.githubusercontent.com/xero/figlet-fonts/master/3d.flf
$ ls ~/.local/share/fonts/figlet-fonts
3d.flf

撰寫 Shell Script Function <放在家目錄即可>

$ cd ~
$ vi lolbanner
===============================================
#!/bin/bash
input=$*
function lolbanner(){
   echo ""
   figlet -c -f ~/.local/share/fonts/figlet-fonts/3d.flf $input | lolcat
   echo ""
}
lolbanner
===============================================
# 給予執行權限
$ chmod +x ~/lolbanner

alias command

$ echo 'alias lolbanner='$HOME/lolbanner'' >> ~/.bash_profile

再次讀取 .bash_profile <下次 login terminal 時會自動讀取>

source ~/.bash_profile

大功告成

    $ lolbanner Let\'s LolBanner

2020年6月29日 Neil Kuan

Follow me

Here's where I hang out in social media