I've added a counter (of successful commands in a row) to my bashrc. I've seen it as high as 120.<p><pre><code> function promptCommand()
{
LAST_STATUS=$?
# Set title of window to dir, then add new line to prompt.
PS1='\[\e]0;\w\a\]\n'
if [ $LAST_STATUS -eq 0 ]; then
((successes++))
PS1+='\[\033[1;32m\][$successes]'
else
successes=0
PS1+='\[\033[1;31m\][0 $LAST_STATUS]'
fi
PS1+='\[\033[0;32m\] '
PS1+='\w $(date +%H:%M) \$ \[\033[0m\]'
}
lastStatus=0
successes=-1
PROMPT_COMMAND="promptCommand"
</code></pre>
My prompt:<p><pre><code> [0] /home/bar/g3 14:19 $ echo "boo"
boo
[1] /home/bar/g3 14:19 $</code></pre>
This reminds me of Vigil, "the eternal morally vigilant programming language" <a href="https://github.com/munificent/vigil" rel="nofollow">https://github.com/munificent/vigil</a>
> The reaction from the OS is actually rather underwhelming.<p>Somehow related, a coworker at a previous place unmounted some disks on an old AIX production box. It took him a solid minute to realise he had mistakenly unmounted / due to a typo (yes it was possible) as old processes with already opened files were happily serving stuff and only new attempts at opening files were beginning to produce errors.<p>Also, a similar interactive mishap in the heat of the action:<p><pre><code> somebox:~$ rm * .o
rm: .o: No such file or directory
somebox:~$ # ...
somebox:~$ # *stares a prompt*
somebox:~$ # Wait, what? _Please_ tell me those C files were versioned! (The answer was, obviously, "no")</code></pre>
On Illumos rm -rf / does nothing. POSIX says that removing / has undefined behavior, so the obviously smart (useful, user-friendly, GOOD) thing to do is to do nothing, as that fits "undefined behavior".
> You know how sometimes if you mistype a filename in Bash, it corrects your spelling and runs the command anyway?<p>What? No, what's that about?
Just have to mention, since I recognize the domain, that Sam Hughes has some excellent science fiction freely available in a serialized form here as well. Well worth investigating.
This is funny. I think I’ll stick with “thefuck” [1] though.<p>It would make a good prank to set up on someone that left their machine unlocked. Not sure if it’s more funny than changing their background to goatse.<p>[1] <a href="https://github.com/nvbn/thefuck" rel="nofollow">https://github.com/nvbn/thefuck</a>
In all seriousness, what if it's a machine that no one should ever really be running commands on? This could be an effective, albeit naive, way to discourage undesirables in the system.
It would be nice for someone to develop a suicide-g++. Whenever you compile a program that results in Undefined Behavior, the execution of it will wipe your disk.
A good read about recovering a system that had rm -rf * run on it:<p><a href="http://www.ee.ryerson.ca:8080/~elf/hack/recovery.html" rel="nofollow">http://www.ee.ryerson.ca:8080/~elf/hack/recovery.html</a>
bash corrects your spelling?? Is this a cute way of saying "I made a typo that turned out to be a legit command" or is there some DWIM I don't know about (and thankfully don't have enabled)?
In the video, the banner the shell displays says:<p><pre><code> =========================================================
WARNING: Suicide Linx installed
(http://sourceforge.net/projects/suicide-linux/)
=========================================================
</code></pre>
I'm wondering if the typo is a subtle joke.
Ah, that video! The good old days of Ubuntu! I just installed 17.10. :-(<p>Edit: The video in question: <a href="https://www.youtube.com/watch?v=Q_pgnMWgd34" rel="nofollow">https://www.youtube.com/watch?v=Q_pgnMWgd34</a>
One idea I like is randomly flipping a bit on the root partition every day or so. You'll have to take an incredibly long time to find the problem, of which there will be one eventually.
Haha, how can it do that out of interest, if you're not root? (As aren't the top level directories in / owned by root?, or does it work anyway, if rm can recurse down? deleting files from the current user)
1) death by accident (or rm -rf'ing) is not suicide
2) has the bar been lowered that much now? a simple bash configuration makes a new O/S or distribution?<p>:-)