wtf

WTF is white tight feet.

  1. 1. text color
  2. 2. printf
  3. 3. function
  4. 4. choose

text color

1
2
3
4
5
6
7
8
9
10
11
12
13
# colors from http://stackoverflow.com/questions/4332478/read-the-current-text-color-in-a-xterm/4332530#4332530
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
BLUE=$(tput setaf 4)
YELLOW=$(tput setaf 3)
NORMAL=$(tput sgr0)

INFO="[ ${BLUE}INFO${NORMAL} ]"
PASS="[ ${GREEN}PASS${NORMAL} ]"
FAIL="[ ${RED}FAIL${NORMAL} ]"
OHNO="[ ${RED}OHNO${NORMAL} ]"
DOTS="[ ${YELLOW}....${NORMAL} ]"
WARN="[ ${YELLOW}INFO${NORMAL} ]"

printf

1
2
3
4
5
fun=ctf
printf "%s is %s" "fun" "$fun"
# fun is ctf
printf "%d" 114514
# 114514

function

1
2
3
4
5
6
7
8
9
BLUE=$(tput setaf 4)
NORMAL=$(tput sgr0)
pwngame() {
game_a="$1"
game_b="$2"
printf "[ ${BLUE}%s${NORMAL} ]: { %s, %s }" "pwngame" "$game_a" "$game_b"
}
pwngame fmtstr heap
# [ pwngame ]: { fmtstr, heap }

choose

1
2
3
4
5
6
7
flag=1
if [ $flag -ge 0 ]; then
echo yyds
else
echo nooo
fi
# yyds

string bool equal: =

本文作者 : wtfff
本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议(CC BY-NC-SA 4.0)进行许可。This blog is under a CC BY-NC-SA 4.0 Unported License
本文链接 : http://im0use.github.io/2022/06/15/shell/

本文最后更新于 天前,文中所描述的信息可能已发生改变