今日、私は Bash-insulterという名前の楽しいコマンドラインスクリプトに出くわしました。 。 Bash-insulterスクリプトは、ユーザーが間違ったコマンドを入力したときにユーザーを侮辱します。 bash-insulterを使用すると、ユーザーがターミナルでスペルミスのあるコマンドを実行したときに、面白くて侮辱的な単語を表示することで、ユーザーを不快にさせることができます。これは、BASHShellバージョン4以降およびZshを含むLinuxおよびUnixライクなオペレーティングシステムで動作します。
Bash-insulterスクリプトは、間違ったコマンドを入力するとユーザーを侮辱します
Gitがインストールされていることを確認してください 。まだインストールされていない場合は、デフォルトのパッケージマネージャーを使用してインストールします。たとえば、DEBベースのシステムで次のコマンドを使用してGITをインストールできます。
$ sudo apt install git
次に、Bash-insulterリポジトリのクローンを作成します。
$ git clone https://github.com/hkbakke/bash-insulter.git bash-insulter
スクリプトを/etc /にコピーします フォルダ。
$ sudo cp bash-insulter/src/bash.command-not-found /etc/
/etc/bash.bashrc
を編集します ファイル:
$ sudo vi /etc/bash.bashrc
次の行を追加します:
if [ -f /etc/bash.command-not-found ]; then . /etc/bash.command-not-found fi
ESCを押します キーを押して:wq
と入力します ファイルを保存して閉じます。
最後に、次のコマンドを実行して変更を更新します。
$ source /etc/bash.bashrc
ここで、間違ったコマンドを入力して、それがどのように侮辱されるかを確認します。
$ unam -a $ clca

Bash-insulterは、間違ったコマンドを入力するとユーザーを侮辱します
笑!おかしいですね。スクリプトの作者は、誰も怒らせない侮辱を追加しました。ただし、必要に応じて独自の侮辱を加えることができます。
これを行うには、/etc/bash.command-not-found
を編集します ファイル:
$ sudo vi /etc/bash.command-not-found
地元の侮辱内で好きなように何かを追加してください ディレクティブ。
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 }
私はいくつかの攻撃的な侮辱を加えました。下のスクリーンショットで自分を見てください。

Bash-insulterを使用して間違ったコマンドを入力するときにユーザーを侮辱する
免責事項: このスクリプトを故意または誤って使用して、誰かの気持ちを傷つけた場合、私たちもこのスクリプトの作成者も責任を負いません。このスクリプトは、純粋に娯楽目的です。楽しんでください!