4 ms·
how did you end up doing this accidentally?
by xyos 14y ago
how did you end up doing this accidentally?
- niggler 14y agoI've seen stranger: a redirect gone the wrong way $ foo < bar # runs command `foo`, reading from `bar` on stdin $ foo > bar # runs command `foo`, writing stdout to `bar` Writing `>` instead of `<` has resulted in many a blowup at 3 AM
- huherto 14y agoMy friend did this... rm * -i The system response was "-i not found" or something like that.
- ISL 14y agoI once discovered that apparently rm bob* has completely different behavior from rm bob * The above line of code successfully fixed a bug I'd been trying to find for weeks in source code in the same directory. When I rewrote it from scratch, the bug was gone.
- niggler 14y agorm -i is your friend
- dfrey 14y agoI find rm -i to be unusable because it is so annoying when you are deleting more than a couple files. It would be nice if rm -I (notice the capital) would first determine all of the files to remove, print them out and then ask if you want to delete all of those files. Instead it just says "rm: remove all arguments?" which is clearly much less annoying than having to type y for every file, but it is also mostly useless.
- skateinmars 14y agoZsh almost does this when using rm * : rm /tmp/* zsh: sure you want to delete all the files in /tmp [yn]?
- michaelmior 14y agoThis is certainly different. " bob* " refers to all files that start with "bob". " bob * " refers to a file named bob as well as all files.
- sneak 14y agoThank you, Donny.
- niggler 14y agoprotip: always put -i first. I avert the problem by having rm run interactively by default: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' http://aniggler.tumblr.com/post/44530262158/the-first-thing-i-do-on-any-server-or-mac http://aniggler.tumblr.com/post/44530262158/the-first-thing-...
- mietek 14y agoUntil one day, lulled into a false sense of security, you find yourself on a system without these aliases…
- hakaaaaak 14y agoI usually don't alias the command itself; that's bad form. It limits what you can do and screws you when you are using an environment without your alias when you forget it. Live and learn.
- opcode 14y agoI did this with a DELETE SQL WHERE clause, trying to isolate a set of records, instead selecting all records, in an effort to test a production installation, at 3am (YES) and had to buy 3 db admins lunch the following day because they came in to restore multiple customer tables. The DELETE's were triggered across numerous tables and platforms (AS400 and SQL Server). The walk of shame to tell my director was not my most shining moment. I'd like to go back in time and slap myself just moments before. Running commands on live production data. Silly programmer.
- sneak 14y agoAt least with MySQL's tools, thanks to ssh's happiness to work as a pipe, it's very easy to clone a database locally for fucking about when you're trying to do something like this: ssh remotehost.example.com mysqldump -udbuser proddatabase | mysql -uroot testdatabase (n.b. the mysqldump options that may lock your production tables during the dump.)
- RyanGWU82 14y agoExactly -- I was benchmarking a disk that was having a performance problem. and I did something like "dd if=/dev/zero of=/dev/sda" instead of "of=/testfile".