3 ms·
Alternatively pipx install llm explain() { # Use llm to generate a simple explanation for a command. # Example: explain 'fortune | cowsay' local s
by irthomasthomas 2y ago
Alternatively
pipx install llm
explain() {
# Use llm to generate a simple explanation for a command.
# Example: explain 'fortune | cowsay'
local system_prompt="Be brief. Mention only serious errors, if any, otherwise just explain the code."
local query="$1"
llm "$query" --system "$system_prompt" "${@:2}"
}
explain 'fortune | cowsay'
This command combines two fun Unix/Linux utilities:
1. `fortune`: This program generates a random quote or short message, often humorous or thought-provoking.
2. `cowsay`: This is a program that generates ASCII art of a cow (or other character) with a speech bubble containing a message.
The pipe (`|`) between them takes the output of `fortune` and feeds it as input to `cowsay`.
So when you run this command, you'll see an ASCII art cow "saying" a random fortune message. It's a playful way to display random quotes or messages in the terminal.
Example output might look like:
_________________________________________
/ Q: How many Marxists does it take to \
| screw in a light bulb? A: None: The |
\ light bulb contains the seeds of its /
\ own revolution. /
---------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||