cp -n vs. test -f

Scot Hetzel swhetzel at gmail.com
Tue Jan 24 10:26:58 PST 2006


On 1/24/06, Andrew P. <infofarmer at gmail.com> wrote:
> So why do we use "if [ ! -f file ] ; then cp file.new file; fi"
> instead of "cp -n file.new file" in pkg-plist's and many
> other places? I think the "cp -n" way is what we really
> mean to do.
>
We probably don't use it because of the following at the bottom of the
cp man page.

"The -v and -n options are non-standard and their use in scripts is
not recommended."

Scot
--
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.


More information about the freebsd-ports mailing list