Re: [APPL:DarwinDev] Re: cp -f option
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com User-agent: Mutt/1.4.2.1i On Wed, Oct 11, 2006 at 01:12:37PM -0700, Jeffrey Ellis scratched on the wall:
on 10/11/06 6:32 AM, darwin-dev-request@lists.apple.com at darwin-dev-request@lists.apple.com 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...
The whole point of "-f" is expressed in the last four words of the description: "....regardless of its permissions." "Its", in this case, is the file that is about to be overwritten. That's the difference between the default "no option" behavior of cp and "-f". cp, by default, will not overwrite a file if the user lacks write permission. "-f" will overwrite such a file, assuming the user has permission to grant themselves write permission. -j -- Jay A. Kreibich | CommTech, Emrg Net Tech Svcs jak@uiuc.edu | Campus IT & Edu Svcs <http://www.uiuc.edu/~jak> | University of Illinois at U/C _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jay A. Kreibich