Mentre -R è posix ben definito, -r non è portatile!
Su Linux, nelle implementazioni GNU e BusyBox di cp , -r e -R sono equivalenti.
D'altra parte, come puoi leggere nella pagina di manuale POSIX di cp , -r comportamento è definito dall'implementazione .
* If neither the -R nor -r options were specified, cp shall take actions based on the type and contents of the file referenced by the symbolic link, and not by the symbolic link itself. * If the -R option was specified: * If none of the options -H, -L, nor -P were specified, it is unspecified which of -H, -L, or -P will be used as a default. * If the -H option was specified, cp shall take actions based on the type and contents of the file referenced by any symbolic link specified as a source_file operand. * If the -L option was specified, cp shall take actions based on the type and contents of the file referenced by any symbolic link specified as a source_file operand or any symbolic links encoun- tered during traversal of a file hierarchy. * If the -P option was specified, cp shall copy any symbolic link specified as a source_file operand and any symbolic links encoun- tered during traversal of a file hierarchy, and shall not follow any symbolic links. * If the -r option was specified, the behavior is implementation- defined.
-r minuscolo era un'opzione precedente, introdotta in 4.1BSD, che copiava semplicemente tutte le non directory come file. Cioè, se incontra un dispositivo o FIFO, lo apre, legge il contenuto e crea un file nella destinazione con il contenuto.
-R maiuscolo era un'opzione standardizzata (introdotta in BSD in 4.4BSD, sebbene le versioni precedenti lo avessero come sinonimo di -r ) che, incontrando un dispositivo, un FIFO o un altro file speciale, creerebbe un file speciale equivalente nella destinazione.
Molte implementazioni mantengono ancora questa distinzione, ma alcune (inclusa la versione GNU tipica di Linux) forniscono solo -R semantica, con -r come sinonimo.
La differenza è che uno usa una "R" minuscola e l'altro usa una "R" maiuscola. Oltre a ciò, nessuna differenza. Stessa cosa se usi --recursive opzione lunga.