Skip to content

Latest commit

 

History

History
119 lines (75 loc) · 2.87 KB

README.md

File metadata and controls

119 lines (75 loc) · 2.87 KB

Nasty

bash-insulter

Randomly insults the user when typing wrong command.

Change insults as needed :)

k4ustu3h on glitch ~
❯ sl

  This is not a search engine.

zsh: command not found: sl

k4ustu3h on glitch ~
❯ thiccman install git

  lmao ded

zsh: command not found: thiccman

k4ustu3h on glitch ~
❯ gti status

  Should I link a YouTube video on how to do this?

zsh: command not found: thiccman

k4ustu3h on glitch ~
❯ sp aux

  What if... you type an actual command the next time!

zsh: command not found: sp

Compatibility

  • Bash v4 and newer
  • Zsh

Installation

Bash or ZSH

    sudo wget -O /etc/bash.command-not-found https://raw.githubusercontent.com/k4ustu3h/bash-insulter/main/src/bash.command-not-found

Then source the file automatically for new logins by adding the following to /etc/bash.bashrc or any of the other locations where you can configure your shell automatically during login:

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

Restart the terminal or login again and type some invalid commands for the effects to be visible.

Note: You will have to add the script to .zshrc if you are using zsh

Termux

    pkg install ncurses-utils
    sudo wget -O /etc/bash.command-not-found https://raw.githubusercontent.com/k4ustu3h/bash-insulter/main/src/bash.command-not-found

Then add the following to /data/data/com.termux/files/usr/etc/bash.bashrc

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

Configuration

bash-insulter can be customized, or even be made polite and nice, by populating CMD_NOT_FOUND_MSGS or CMD_NOT_FOUND_MSGS_APPEND environment variables. The values should be arrays. CMD_NOT_FOUND_MSGS replaces the default messages, while CMD_NOT_FOUND_MSGS_APPEND appends more messages to the existing ones.

It is probably cleanest to source a file populating the environment variable as needed. In this example I create a file /etc/bash.command-not-found-messages with the following content:

    CMD_NOT_FOUND_MSGS=(
        "You are so smart!"
        "You look pretty today!"
        "I don't know what to say"
    )

Then source this file before you source the script:

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

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

Then restart the terminal or logout and in again. The end result is that you will now use your messages instead of the default ones.


Smile 60%