minor `cp -R` question

Tom McLaughlin tmclaugh at sdf.lonestar.org
Tue Dec 23 18:13:43 PST 2003

Hi, I have a quick question about the cp command and recursively copying
a directory.  If I type:

$ cp -R /foo/file/ ~/

I get in my home directory a file called "file".  If I type:

$ cp -R /foo/file ~/

I get in my home directory a directory called "foo" and a file called
"file".  Can someone explain why the trailing slash cp to behave

My user shell is pdksh and the root shell is csh.  I have pdksh set to
use "complete-list" and csh to use "autolist".  Is this behavior just
something unique to FreeBSD?  I tried the same on my OpenBSD box and the
two commands worked the same and created a directory with a file in it. 
I also don't remember these working differently on linux.  Do I possibly
have something setup wrong with my shells?  Thanks.

More information about the freebsd-questions mailing list