|
|
Watch out for mv command and symlinks on Samba shares
This example is equivalent to issuing the command mv foo foo with a file named foo in the current directory, i.e. you're overwriting a file with itself. On a local HFS+ or UFS filesystem, this really shouldn't cause any harm, but it looks like the poster has discovered that this isn't a safe operation on a windows share. This is probably a bug that should be reported to Apple - the rename operation is probably being translated into the wrong sequence of smb operations.
Until this is fixed, you can help prevent it in the future by aliasing mv to mv -i, which gives you an "are you sure?" prompt before any potentially destructive operations. You might also consider doing the same for the cp and rm commands. In order to add such aliases to your environment, add these lines to your .tcshrc file if you are using tcsh:
alias rm 'rm -i' alias mv 'mv -i' alias cp 'cp -i' For bash, add this to your .bashrc:
alias rm='rm -i' alias mv='mv -i' alias cp='cp -i' These have been mentioned in several comments in the past, but seemingly never as a hint. Does one the of the Mac OS X bibles have a section on well-known UNIX shell additives that would be useful to newbies?
Watch out for mv command and symlinks on Samba shares
Small correction, use .profile in the root of your home directory, not .bashrc
Than make sure you shutdown that terminal session and start again. It should work now. BTW, I believe this is standard operation with the mv command, at least in Linux that's how it works. That is why the "-i" option exists, to warn you. Normally what you say is what it does. Be careful with the command line. On at least two occasions, I did a "rm -r *" thinking I was in the "/tmp" directory, when I was actually at the root while logged on as root. By the time you realize what you just did, its to late. Be careful!
root implies being careful
On at least two occasions, I did a "rm -r *" thinking I was in the "/tmp" directory, when I was actually at the root while logged on as root.This would seem to indicate that you should not log on as root.
root implies being careful
Actually this happened to me the other day while connected smb to my linux box. I deleted a symlink file toa dir in the Finder and it deleted the actual dir. Luckily it wasn't anything important.
Watch out for mv command and symlinks on Samba shares
No, NO, NO!!!! |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.08 seconds |
|