5 ms·
I'm still scared every time I use rsync because of that and have to thoroughly check the man-page examples :)
by l33tman 5y ago
I'm still scared every time I use rsync because of that and have to thoroughly check the man-page examples :)
- thwarted 5y agoNo need to fear! Use --dry-run to confirm your command line before making the changes. It's documented in that very man page!
- 0des 5y agoI have a list of aliases I pass to my minions, one is to alias rsync with this, and the real rsync is aliased as rsyncplz
- teddyh 5y agoThat kind of stuff sounds good, but it’s dangerous. You risk getting used to it, and then getting hosed when you’re on a normal system. Some people use a similar thing where they set "rm" as an alias to "rm -i", i.e. ask interactively before removal of each file. I once heard a story about some SunOS consultant who was used to "rm" being an alias for "rm -i", and the first thing this consultant did, as root, was to "cd /etc" and then "rm *".
- layer8 5y agoIn principle this could be solved by having two aliases `rsync-dry-run` and `rsync-for-real`, and aliasing `rsync` to `echo "Use rsync-dry-run or rsync-for-real“`.
- 0des 5y agoThat's great, I'll do that now. Thanks!
- justinsaccount 5y agoOne of my first introductions to the fact that GNU getopt is much different from BSD/UNIX getopt was running `rm * -i` on Solaris. Instead of prompting me for which files to delete, it removed all of my files and then printed an error about failing to remove the non existent file "-i".