外壳还能更“进攻”一点吗?

外壳还能更“进攻”一点吗?

我的根图Linux 是用进攻使用旗帜启用:

# 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

好吧,通过使用PS1and 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.

相关内容