Date: Mon, 18 Nov 2002 01:10:02 -0800 (PST) From: Peter Pentchev <roam@ringlet.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/45333: [PATCH] New option -r for chown and chgrp Message-ID: <200211180910.gAI9A2Z5002611@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/45333; it has been noted by GNATS. From: Peter Pentchev <roam@ringlet.net> To: Oliver Fromme <olli@secnetix.de> Cc: bug-followup@FreeBSD.org, Oliver Fromme <olli@fromme.com> Subject: Re: bin/45333: [PATCH] New option -r for chown and chgrp Date: Mon, 18 Nov 2002 11:03:30 +0200 On Sat, Nov 16, 2002 at 11:56:37AM +0100, Oliver Fromme wrote: > > >Number: 45333 > >Category: bin > >Synopsis: [PATCH] New option -r for chown and chgrp > >Originator: Oliver Fromme > >Release: FreeBSD -stable and -current > >Organization: > secnetix GmbH & Co KG, Munich, http://www.secnetix.de/ > >Environment: > > The patch presented applies both to -stable and -current > as of the date of submission (2002-11-16). > > >Description: > > The existing utilities touch(1) and truncate(1) support > an -r option to specify a reference file from which > information is to be taken (the time stamp in the case > of touch(1) and the file size in the case of truncate(1)). > > However, the utilities chown and chgrp (actually hardlinks > to the same binary) do not support such an option yet. > In shell scripts it is sometimes useful to copy ownership > and/or group membership from another file. Ordinarily, > you would have to use ls -l and parse the owner/group > columns, which is awkward, error-prone and inefficient. For the record, a cleaner way to do this would be to use the stat(1) utility, which is only available in -current for the present. [roam@ref5 ~]$ stat -f '%Su:%Sg' /etc/passwd root:wheel [roam@ref5 ~]$ Thus, something like "chown `stat -f '%Su:%Sg' $reffile` $file" would probably do what you need. Of course, a command-line option might be a bit easier to use :) G'luck, Peter -- Peter Pentchev roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 This sentence contains exactly threee erors. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211180910.gAI9A2Z5002611>