(Update: this happens on Mac OS X -- I am using Mountain Lion.) It sometimes happen that I use the tab key to complete the path, so my command may be:
cp -r ~/some/folder/ .
but it turns out that the line above has a different behavior from
cp -r ~/some/folder .
the second line will copy the folder into the current directory, as
folder, but the first line will copy all 7 files, 6 subfolders into the current directory, contaminating the current directory. Since I don't do any source control using git or svn in that particular current directory, it actually has to be cleaned up manually, and it is quite a pain.
Is there a way to prevent this from happening? Such as by making a function, alias, or Bash setting? I know I can remember this, but 2 months down the road, I can actually accidentally do the same thing again, so it is better to guard against this behavior. (I would rather needing to use
cp -r ~/some/folder/* . and
cp -r ~/some/folder/.* . if that is what I really want.)