Last active
August 29, 2015 13:56
-
-
Save cades/9021409 to your computer and use it in GitHub Desktop.
把 lisp-koan 的輸出加上顏色
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sbcl --script contemplate.lsp | tail -n 13 \ | |
| sed "s/INCOMPLETE/`tput setaf 6`INCOMPLETE`tput sgr0`/g" \ | |
| sed "s/FAIL/`tput setaf 1`FAIL`tput sgr0`/g" \ | |
| sed "s/PASS/`tput setaf 2`PASS`tput sgr0`/g" | |
# 未完成=青色 | |
# 失敗=紅色 | |
# 通過=綠色 | |
# 關於色碼控制, 這次的成果是用tput的解法 | |
# 參考 http://en.wikipedia.org/wiki/Tput | |
# 關於sed, 用單引號'或雙引號"夾住指令, 似乎有很大的差別喔. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
行末的backslash後面不能接註解, 因為那是跳脫換行字元用的