Shell
外殼可以更“攻擊性”嗎?
我的Gentoo Linux 編譯時啟用了令人反感的USE標誌:
# 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 僅用於此處的奶牛外觀,請參見聯機幫助頁。
好的,通過使用
PS1
andcommand_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\$ "; `'