Kann die Granate noch „offensiver“ sein?

Kann die Granate noch „offensiver“ sein?

MeinGentooLinux wird kompiliert mit dembeleidigendVERWENDENFlaggeermöglicht:

# sudo su -
Password: 
Hold it up to the light --- not a brain in sight!
Password: 

Es ist auch möglich, auszuwählenVermögenbasierend auf dem Grad der Beleidigung:

# fortune -o kernelcookies | cowsay -b
 _________________________________________ 
/ /* This is total bullshit: */           \
|                                         |
\ linux-2.6.6/drivers/video/sis/init301.c /
 ----------------------------------------- 
        \   ^__^
         \  (==)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Wenn man bedenkt, dass die Liste der aromatisierten Produkte 1 im Link kurz ist - und ich persönlich benutze keinMolekulardynamik-Simulationspaket- gibt es noch mehr von dieser Art von Gewürz in derSchale(n)in Linux im Allgemeinen (oder UNIX)?


1- Es ist gut, sich daran zu erinnerncowsaykann jedes Argument ausgeben, nicht nur Prognosen, beispielsweise die Ausgabe eines Befehls oder Skripts: cowsay -s $(script_in_path_or_command). Hinweis: -s dient hier nur dem Erscheinen der Kuh, siehe Manpages.

Antwort1

Ok, durch die Verwendung von PS1und command_not_found_handlekann es passieren, dass Bash Sie beleidigt:

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:~$ 

Und hier ist /tmp/insult.shdie Quelle, die ich oben angegeben habe.

### 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\$ "; 
`'

Antwort2

Jemand erwähntesl. In Software wie einem Interpreter, der auf maximale Vorhersagbarkeit abzielt,Überraschungist in diesem Kontext sicherlich etwas „Beleidigendes“. Das Handbuch listet auch entsprechende Optionen auf:

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.

...und eine interessanteInsekt:

BUGS
   It sometimes list directory contents.

verwandte Informationen