Bash

Me gustaría compartir un script de línea de comandos que acabo de encontrar en Reddit. Bash-insulter, un script simple que insulta al usuario cada vez que escribe un comando Unix incorrecto. Usando bash-insulter, puede avergonzar al usuario por cualquier comando mal escrito en su Terminal. Funcionará en cualquier sistema operativo similar a Unix que contenga BASH Shell.

Asegúrate de haber instalado Git. Si aún no está instalado, usa el administrador de paquetes predeterminado para instalarlo. Por ejemplo, puedes instalar Git usando el siguiente comando en cualquier sistema basado en DEB:

sudo apt install git

Y clonamos el repositorio:

git clone https://github.com/hkbakke/bash-insulter.git bash-insulter

Copia el script a  /etc/ :

sudo cp bash-insulter/src/bash.command-not-found /etc/

Edita /etc/bash.bashrc:

sudo vi /etc/bash.bashrc

Añade estas líneas:

if [ -f /etc/bash.command-not-found ]; then
    . /etc/bash.command-not-found
fi

Guarda y cierra usando :wq.

Finalmente aplicamos los cambios:

source /etc/bash.bashrc

Ahora, escribe algún comando incorrecto para ver cómo te insulta:

$ unam -a

$ clca

bash-insulter

El autor ha agregado insultos que no ofenden mucho. Puedes agregar tus propios insultos como lo desees.

Para hacerlo, edita /etc/bash.command-not-found:

sudo vi /etc/bash.command-not-found

Agrega algo como desees dentro de la directiva de insultos locales:

command_not_found_handle () {
 local INSULTS=(
 "Boooo!"
 "Don't you know anything?"
 "RTFM!"
 "Hahaha, n00b!"
 "Wow! That was impressively wrong!"
 "What are you doing??"
 "Pathetic"
 "The worst one today!"
 "n00b alert!"
 "Your application for reduced salary has been sent!"
 "lol"
 "u suk"
 "lol... plz"
 "plz uninstall"
 "And the Darwin Award goes to.... ${USER}!"
 "ERROR_INCOMPETENT_USER"
 "Incompetence is also competence"
 "Bad."
 "Fake it till you make it!"
 "What is this...? Amateur hour!?"
 "Come on! You can do it!"
 "Nice try."
 "What if... you type an actual command the next time!"
 "What if I told you... it is possible to type valid commands."
 "Y u no speak computer???"
 "This is not Windows"
 "Perhaps you should leave the command line alone..."
 "Please step away from the keyboard!"
 "error code: 1D10T"
 "ACHTUNG! ALLES TURISTEN UND NONTEKNISCHEN LOOKENPEEPERS! DAS KOMPUTERMASCHINE IST NICHT FÜR DER GEFINGERPOKEN UND MITTENGRABEN! ODERWISE IST EASY TO SCHNAPPEN DER SPRINGENWERK, BLOWENFUSEN UND POPPENCORKEN MIT SPITZENSPARKEN. IST NICHT FÜR GEWERKEN BEI DUMMKOPFEN. DER RUBBERNECKEN SIGHTSEEREN KEEPEN DAS COTTONPICKEN HÄNDER IN DAS POCKETS MUSS. ZO RELAXEN UND WATSCHEN DER BLINKENLICHTEN."
 "Pro tip: type a valid command!"
 "Go outside."
 "This is not a search engine."
 "(╯°□°)╯︵ ┻━┻"
 "¯\_(ツ)_/¯"
 "So, I'm just going to go ahead and run rm -rf / for you."
 "Why are you so stupid?!"
 "Perhaps computers is not for you..."
 "Why are you doing this to me?!"
 "Don't you have anything better to do?!"
 "I am _seriously_ considering 'rm -rf /'-ing myself..."
 "This is why you get to see your children only once a month."
 "This is why nobody likes you."
 "Are you even trying?!"
 )

# Seed "random" generator
 RANDOM=$(date +%s%N)
 VALUE=$((${RANDOM}%2))

if [[ ${VALUE} -lt 1 ]]; then
 printf "\n $(tput bold)$(tput setaf 1)$(shuf -n 1 -e "${INSULTS[@]}")$(tput sgr0)\n\n"
 fi

echo "-bash: $1: command not found"

# Return the exit code normally returned on invalid command
 return 127
}

He agregado algunos insultos agresivos. Véase en la captura de pantalla siguiente.

bash-insulter-1

 

Fuente: Original | maslinux

¿Quién está en línea?

Hay 25851 invitados y ningún miembro en línea