5 ms·
I wish there were an idiot mode for unix that would tell you exactly what the command you just entered is going to do. I'd be turning it on all the time when u
by stretchwithme 17y ago
I wish there were an idiot mode for unix that would tell you exactly what the command you just entered is going to do. I'd be turning it on all the time when using commands I rarely use.
It would be nice to know I'm about to do something that I don't intend. As long as the system doesn't ask me "are you sure you're sure you're sure?"
- jrockway 17y agoRedhat's default bashrc aliases rm to rm -i. The i stands for idiot. (But of course, -f overrides -i, so maybe it's actually a wrapper. Who knows.) What we really need are transactions or a versioned filesystem. rm -rf *? rollback!
- eru 17y agoYes, undo rather than confirmation is not only a good idea for GUIs, but also for CLUEs [1]. [1] Command Line User Environment
- IgorPartola 17y agoCommand line mysql client has a i-am-a-dummy mode where you cannot run a query like "DELETE FROM table". You could of course run "DELETE FROM table WHERE 1=1" but at least it saves you sometimes.
- Davertron 17y agoThis is awesome, I never knew about this; I usually type "delete from where" and then fill out the query, just to avoid accidentally hitting enter after typing "delete from users". For me, this is sort of like standing at the edge of a big cliff; you just have this weird feeling that you might accidentally, compulsively jump.
- cynicalkane 17y agoMan, I thought I was the only one who felt like this (the cliff thing). I told a friend once and he became worried that I was suicidal. (I'm not.)
- epochwolf 17y agoI get that too :)
- daflip 17y agoWHERE 1=1 won't actually work when i-am-a-dummy mode is enabled. You must reference at least one KEY column in the where clause.
- IgorPartola 17y agoWell, my point is that there are ways around it. Like WHERE id IS NOT NULL, or WHERE id=1 OR 1=1. It's not full-proof, it just protects you from writing out a query that is not complete. It sort of sucks that in SQL you first say what action you want to perform and then say what you want to perform it on. I end up writing the WHERE part of every query first anyways.
- k2jacob 17y agoIn C# query syntax, you write in this order: from where select I like it that way; it happens to already match the way my mind plans a relational query.
- Pistos2 17y agoAlso useful: BEGIN;^M<potentially dangerous query>;^M<look at results>[COMMIT|ROLLBACK];^M
- viraptor 17y agoZsh does that for you: $ rm * zsh: sure you want to delete all the files in /home/viraptor/tmp/zsh [yn]?
- Pistos2 17y agoNice: also prompts when using the -rf options.