
# sudo su -
Password:
Hold it up to the light --- not a brain in sight!
Password:
也可以選擇財富依攻擊性程度:
# fortune -o kernelcookies | cowsay -b
_________________________________________
/ /* This is total bullshit: */ \
| |
\ linux-2.6.6/drivers/video/sis/init301.c /
-----------------------------------------
\ ^__^
\ (==)\_______
(__)\ )\/\
||----w |
|| ||
考慮到連結中提供的風味物品清單1很短 - 而且我個人不使用分子動力學模擬包- 裡面還有那種香料嗎外殼一般在 Linux(或 UNIX)中?
1-記住這一點很好cowsay
可以輸出任何參數,而不僅僅是命運,例如命令或腳本的輸出:cowsay -s $(script_in_path_or_command)
。注意 -s 僅適用於此處牛的外觀,請參閱線上說明頁。
答案1
好吧,透過使用PS1
and command_not_found_handle
,bash 可能會侮辱你:
anthony@Watt:~$ . /tmp/insult.sh
anthony@Watt:~$ sl
bash: sl: command not found, incompetent spoony bard
anthony@Watt:~$ ls /wrong/path
ls: cannot access /wrong/path: No such file or directory
Learn to type, second-rate Horrified Heron.
anthony@Watt:~$
這是/tmp/insult.sh
我在上面獲取的。
### Data ###
bash_insulter_sentences=(
'Have you considered Windows, %s?\n'
'Learn to type, %s.\n'
'Fell asleep at the keyboard again, %s?\n'
"Failure is common when you're a %s, isn't it?\n"
)
bash_insulter_subjects=(
'spoony bard' # we all played this, right?
'extra-Warty Warthog'
'Dazed Drake'
'Fidgety Fawn'
'Horrified Heron' # etc.
)
bash_insulter_adjectives=(
'incompetent ' # these have built-in spacing
'inept '
'second-rate '
'' # chance of none
''
)
### Functions to generate insults ###
bash_insulter_random_element() {
if [ ${BASH_VERSINFO[0]} -lt 4 ] || \
[ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -lt 3 ]; then
# bash before 4.3 doesn't have -n
eval "local var=(\"\${$1[@]}\")"
else
local -n var="$1"
fi
local len=${#var[@]}
echo -n "${var[$RANDOM % len]}" # Slightly biased. Don't care.
}
bash_insulter_full_subject() {
bash_insulter_random_element bash_insulter_adjectives
bash_insulter_random_element bash_insulter_subjects
}
bash_insulter_do_insult() {
printf "$(bash_insulter_random_element bash_insulter_sentences)" "$(bash_insulter_full_subject)"
}
### set up ###
command_not_found_handle() {
echo "bash: $1: command not found, $(bash_insulter_full_subject)"
return 127
}
PS1='`
if [ 0 -ne $? -a 127 -ne $? ]; then
bash_insulter_do_insult
fi
echo "\u@\h:\w\$ ";
`'
答案2
有人提到sl
。在像解釋器這樣的軟體中,其目標是最大的可預測性,驚喜在上下文中當然可以算是「冒犯性」的東西。手冊還列出了適當的選項:
DESCRIPTION
sl is a highly advanced animation program for curing your bad habit of
mistyping.
-a An accident is occurring. People cry for help.
-l Little version
-F It flies like the galaxy express 999.
-c C51 appears instead of D51.
……還有一個有趣的漏洞:
BUGS
It sometimes list directory contents.