Bash-insulter – 输入错误命令时侮辱用户的脚本

今天我偶然发现了一个有趣的命令行脚本,名为 辱骂. 当用户输入错误的命令时,Bash-insulter 脚本会侮辱用户。 使用 bash-insulter,当用户在终端中运行拼写错误的命令时,您可以通过显示有趣和侮辱性的词语让用户感到不舒服。 它适用于任何包含 BASH Shell 版本 4 和更新版本以及 Zsh 的 Linux 和类 Unix 操作系统。

Bash-insulter 脚本在输入错误命令时侮辱用户

确保您已安装 吉特. 如果尚未安装,请使用默认包管理器进行安装。 例如,您可以在任何基于 DEB 的系统中使用以下命令安装 GIT:

$ sudo apt install git

然后, git 克隆 Bash-insulter 存储库:

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

将脚本复制到您的 /等等/ 文件夹。

$ 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

退出 键和类型 :wq 保存和 close 文件。

最后,运行以下命令来更新更改。

$ 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)nn"  fi  echo "-bash: $1: command not found"  # Return the exit code normally returned on invalid command  return 127 }

我添加了一些攻击性的侮辱。 在下面的屏幕截图中看到自己。