i 've noticed the following difference between freebsd cp and gnu cp
from the freebsd cp man page:
-R ... If the source_file ends in a /, the contents of the directory are copied rather than
the directory itself. ...
on gnu cp from the man page
while on gnu cp manpage:
�-r' �--recursive'
Copy directories recursively. Symbolic links are not
followed by default; see the --archive (-a), -d, --dereference (-L),
--no-dereference (-P), and -H options. Special files are copied by
creating a destination file of the same type as the source; see the
--copy-contents option. It is not portable to use -r to copy symbolic
links or special files. On some non-gnu systems, -r implies the
equivalent of -L and --copy-contents for historical reasons. Also, it
is not portable to use -R to copy symbolic links unless you also
specify -P, as POSIX allows implementations that dereference symbolic
links by default.
the difference above creates problems when one wants to copy all files from a directory to another directory, without copying
the directory itself.
for example what i want to do is copy some files from a source directory and overwrite some files in
the destination directory, i want to do this using a script.
if i ran the script on freebsd i could do something like this
#!/usr/bin/env bash
sourcee='original-configuration/source/'
destination='/etc/destin'
cp -rv ${sourcee} ${destination
}
but in linux i have the following:
#!/usr/bin/env bash
sourcee='original-configuration/source'
destination='/etc/destin'
cp -rv ${sourcee}/* --target-directory=${destination}
is it possible no to use shell globing with gnu cp?
should i use a different tool? or should i use gnu cp in a different way?
thanks in advance for your answers,
nicolas