Follow

Print an ascii cat randomly about every 20th time you type cd in your shell. Write to your ~/.bashrc:
```
cd() {
[[ -t 1 && $((RANDOM%20)) -eq 0 ]] && echo " meow (=^_^=) )~"
builtin cd "$@"
}
```

@adi :blobcat3c: ich sollte das auf all die server auf arbyte packen nur um den mühsamen mitarbeiter zu nerven

@absturztaube Das ist ja nicht nervig, nur wenn er nicht gerne Katzen hat, aber dann hat er es verdient :-D

@adi :blobcatsmug: ich würd die Kadse da dann ersetzen mit was anderem

@adi Great idea for when a colleague forgot to lock his system!

@alex just make sure to replace the cat with a more confusing message like "cd: write error: No space left on device" ;-)

@luna It tests if stdout is opened in a terminal. I had to add it, because copy-pasted commands like `(cd directory && some_command) | another_command` failed.

@luna You can see the difference here:

$ [[ -t 1 ]] && echo yes || echo no
yes
$ ([[ -t 1 ]] && echo yes || echo no) | cat
no

@adi@chaos.social i put it in the cat command, but it echos to stderr so if im using cat to copy files or image stuff, its fine
and also cd too

@irina My pleasure! I'm happy to spread some joy 😃

@adi Would be better for the "cat" command, I would've thought...

Sign in to participate in the conversation
chaos.social

chaos.social – a Fediverse instance for & by the Chaos community