-
Notifications
You must be signed in to change notification settings - Fork 732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cp and rename directory with -r doesn't match unix behavior #256
Comments
Possibly same as #101? Me too would like to get this fixed. |
To get the behavior you want, you must specify a trailing '/'. Change your command to: cp('-r', 'a/', 'b'); Please see #15. I agree that this differs from the Linux behavior. How does this compare with the BSD behavior (such as on OS X)? I know that BSD utilities behave differently if a directory is has a trailing '/'. See this page for more details. This example is slightly different, but I believe the behavior differs in this case as well. If someone could confirm on OS X, that would be helpful. I don't believe POSIX specifies which behavior is correct, but please correct me if I'm wrong. |
@nfischer sorry, I shouldn't have said "in a unix shell", I actually ran my original example on OSX. |
Oh, ok. I'm on Linux, so I can confirm that Linux behaves the way you describe. If OS X also behaves that way, then it sounds like this is not POSIX behavior, and should indeed be fixed. For now though, does the trailing '/' workaround achieve what you need, @jedwards1211? |
@nfischer it does, although of course I had just used |
Would any of you be able to test out #271 and make sure it works as expected? I've tested it, and it seems to resemble the Linux behavior fairly closely (will test again to be completely sure). It'd be great if you guys could confirm as well. |
As shown below, if I do
cp -r a b
with shelljs wherea
is a directory andb
doesn't exist, shelljs createsb/a
directories and the copies the contents ofa
intob/a
. Instead, like in a unix shell, it should createb
directory and copy the contents ofa
intob
.The text was updated successfully, but these errors were encountered: