GNU/Linux >> Linux Esercitazione >  >> Linux

Bash-insulter – Uno script che insulta l'utente quando digita un comando sbagliato

Oggi mi sono imbattuto in un divertente script da riga di comando chiamato Bash-insulter . Lo script Bash-insulter insulta gli utenti quando digitano un comando sbagliato. Usando bash-insulter, puoi mettere a disagio gli utenti visualizzando parole divertenti e offensive quando eseguono un comando errato nel Terminale. Funzionerà su qualsiasi sistema operativo simile a Linux e Unix che contiene BASH Shell versione 4 e successive e Zsh.

Lo script Bash-insulter insulta gli utenti quando digitano un comando sbagliato

Assicurati di aver installato Git . Se non è già installato, usa il tuo gestore di pacchetti predefinito per installarlo. Ad esempio, puoi installare GIT utilizzando il seguente comando in qualsiasi sistema basato su DEB:

$ sudo apt install git

Quindi, git clona il repository Bash-insulter:

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

Copia lo script nel tuo /etc/ cartella.

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

Modifica /etc/bash.bashrc file:

$ sudo vi /etc/bash.bashrc

Aggiungi le seguenti righe:

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

Premi ESC digitare e digitare :wq per salvare e chiudere il file.

Infine, esegui il comando seguente per aggiornare le modifiche.

$ source /etc/bash.bashrc

Ora, digita un comando sbagliato per vedere come ti insulta.

$ unam -a

$ clca

Bash-insulter insulta gli utenti quando digitano un comando sbagliato

LOL! Divertente, no? L'autore della sceneggiatura ha aggiunto degli insulti che non offendono molto nessuno. Puoi, tuttavia, aggiungere i tuoi insulti come desideri.

Per farlo, modifica /etc/bash.command-not-found file:

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

Aggiungi qualcosa come desideri negli insulti locali direttiva.

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
}

Ho aggiunto alcuni insulti aggressivi. Vedi te stesso nello screenshot qui sotto.

Insulta gli utenti quando digitano un comando sbagliato utilizzando Bash-insulter

Disclaimer: Né noi né l'autore di questo script siamo responsabili se hai offeso i sentimenti di qualcuno, utilizzando intenzionalmente o accidentalmente questo script. Questa sceneggiatura è puramente a scopo di divertimento e intrattenimento. Buon divertimento!


Linux
  1. CentOS/RHEL – Come eseguire uno script o un comando quando un utente si disconnette dalla sessione ssh

  2. Specificare l'utente from quando si invia un'e-mail utilizzando il comando mail

  3. Come eseguire un comando come utente specifico in uno script init?

  4. Come reindirizzare l'output di un comando a un file quando il comando richiederà gli input dell'utente?

  5. Richiedi all'utente di accedere come root durante l'esecuzione di uno script di shell

8 comandi inquietanti che perseguitano il terminale

Come utilizzare il comando usermod in Linux

Comprendere la differenza tra il comando sudo e su su Linux

Il comando di spegnimento?

Useradd vs Adduser:qual è la differenza?

Come utilizzare il comando ulimit in Linux