Live data from Hacker News

Suicide Linux

qntm.org

91–100 of 135 posts

Re: Suicide Linux

#91
post #40

I've added a counter (of successful commands in a row) to my bashrc. I've seen it as high as 120. 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…

Man, I hope you don't use grep very often (by default it uses exit code 1 when it doesn't find anything).

just add a '|| true' at the end of every call to grep!

Re: Suicide Linux

#93
post #30

> The reaction from the OS is actually rather underwhelming. 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. Also, a simil…

Once I wiped /etc/passwd on a Solaris system due to a typo.

Luckily I was able to recover its contents, while hoping not to lose the network connection during the process.

Re: Suicide Linux

#94
post #47

> You know how sometimes if you mistype a filename in Bash, it corrects your spelling and runs the command anyway? What? No, what's that about?

Yeah, I'm not aware of any distro that has this setting enabled by default. It's neat that it exists, though.

Distros in the late 90s were a lot more adventurous in their defaults as I recall.

Re: Suicide Linux

#95

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".

That's quite funny... but ultimately futile. It doesn't say what happens if you say "DROP TABLE xyz WHERE...ohshit". (The bit is because you're used to doing that in your preferred SQL-DB editor.) One should NEVER do anything non-scripted on a production system. ALWAYS enter it into a file and then do the "run-sql-from-a-file" command. EDIT: Yes, I also realize that "rm -rf /" can theoretically happen if you have a b…

If you work interactively you can use tab completion which takes care of most typos. That's something you don't have in scripts.

Re: Suicide Linux

#96
post #54

Earlier quoted context omitted.

Tip: If you ever trigger sl by mistake, and you're in a hurry, press Ctrl+Z instead of Ctrl+C (which doesn't work).

That seems like a bug in sl: it should signal(SIGTSTP, SIG_IGN) (or put the terminal in raw mode, better yet)

https://github.com/mtoyoda/sl/pull/51

Re: Suicide Linux

#98

Earlier quoted context omitted.

If it didn't exist in the first place, then you had no business searching for it. You should have just known not to look. :)

Negative result is still a result. I sometimes use `grep -r` to check whether "does this set of files contain this particular string?" and "no" is a useful answer :)

twas a joke.

Re: Suicide Linux

#99
post #67

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.

So it just always writes a program that does `system(rm -rf /)`?

Re: Suicide Linux

#100
post #40

Earlier quoted context omitted.

Man, I hope you don't use grep very often (by default it uses exit code 1 when it doesn't find anything).

If it didn't exist in the first place, then you had no business searching for it. You should have just known not to look. :)

I like this joke, it kind of reminds me of the difference between `find_by_id` and `find` in ruby on rails.

In the former, if a result can't be found it will return `nil` but in the latter it expects the record to exist and so will raise an exception if it can't be found.

Post reply on HN