|
|
Or learn to avoid the problem
I've lived in multiple unix worlds for a while and versions of this "problem" come. The basic problem is seen in the discussion here. Some people see the slash and say "ah, stuff inside the folder". Other people see the slash and say "ah, the folder". Surprise, surpise... those who programmed the different shells (tcsh, bash, sh, etc) are people, too. Like a lot of things unix, you can come up with a simple approach that works across _all_ shells and not have to hack each computer you use. An example is using cp -R instead of cp -r. Both mean recursive (e.g. go through all the nested folders) but a lot of unix commands only recognize the -R. Computers are so darn literal sometimes. Back to the problem at hand... I avoid the problem by (begin really deep insight) explicitly telling the computer whether I want to deal with a folder _or_ all the stuff in it. If I want the directory, I'll leave off the slash: cp -R stuff ~/ If i want to the stuff in the directory, I'll add a slash and the wildcard: cp -R stuff/* ~/ The final fly-in-the-ointment is that dot files (i.e. files whose names begins with a dash) are hidden from view by default and sometimes will not copy this way, so you may have to do a second copy by putting /.* on the end of the directory name: cp -R stuff/.* ~/
Or learn to avoid the problem
You have to be careful with '~/folder/.*'. That covers the dot-files, yes, but it also covers 'dot' and 'dot dot', meaning the folder itselft and the parent folder.
Or learn to avoid the problem - better solution for dotfiles
As thadman08 pointed out, .* matches .. as well as the intended dotfiles.
My incantation to get around this was to use .[A-z]* Un*x sux, btw. Fifty years of computer science and here we are arguing about how to copy some goddamn files ... |
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.09 seconds |
|