Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cp -f option



In message <C1529E45.49CDE%email@hidden>, Jeffrey Ellis writes:
>
>on 10/11/06 6:32 AM, email@hidden at
>email@hidden wrote:
>
>>> Sorry for being dense. Not sure I understand exactly what this does. Can
>>> someone explain this...?
>>> 
>>> -f    For each existing destination pathname, remove it and create a new
>>>           file, without prompting for confirmation regardless of its
>>> permissions.
>>> 
>>> Doesn't cp do this by default unless you use -i or -n ...which this
>>> overrides?
>> 
>> No.
>> 
>> $ cd /tmp
>> $ cp /dev/null t
>> $ chmod 600 t
>> $ cp /dev/null t
>> $ chmod 0 t
>> $ cp /dev/null t
>> cp: t: Permission denied
>> $ cp -f /dev/null t
>> $
>> 
>> -s
>
>Hi, Peter--
>
>Sorry, but could you please explain this output step by step? I'm not sure I
>really get what's happening...

1.  Create file called t.
2.  Give self read/write privs on t.
3.  Copy over t.  It works, no problems.
4.  Remove read/write privs on t.
5.  Copy over t.  Fails, permission denied.
6.  Copy over, with -f, t.  Succeeds.

In short, that's what the -f flag does; it overrides permissions if it is
able to do so.

-s
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: cp -f option (From: Jeffrey Ellis <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.