简体   繁体   中英

Unix Terminal error - “cp: the -R and -r options may not be specified together.”

I have bash script running on os-x unix with above command:

cp -avr source destination

The result is following error:

cp: the -R and -r options may not be specified together.

When I remove the a flag it works OK without errors.

Why and what is the meaning of this error?

Thanks,

Have a look at man page for cp :

-a, --archive same as -d R --preserve=all

-R, -r , --recursive copy directories recursively

So by specifying -a , you basically say:

cp -dRvr --preserve=all source destination

You have both -R and -r , and since those two are same, it warns you. To fix that, just remove -r :

cp -av source destination

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM