Re: [PATCH] doc: add example for %G format directive

Bernhard Voelker <[email protected]> Sun, 8 Mar 2026 14:56:56 +0100
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
Hello,

On 3/6/26 00:31, raf wrote:
> On Tue, Mar 03, 2026 at 11:06:47PM +0530, Abhishek Kumar <[email protected]> wrote:
>> While reading the documentation, I noticed that the %G format directive did
>> not include a usage example. I have added a small example to improve
>> clarity for users.

Thanks for the patch.

> I don't think it illustrates anything that isn't
> already obvious. Also, it's a very contrived example
> that only outputs the numeric group id all by itself.

I agree with Raf: I don't see why %G would be special compared to the other
format directives.  Hence adding a separate -printf example to each of
them would more distract from the topic than help.

> Is that something anyone would ever want to do?
> Probably not.

Well, one never knows if someone might check on a single file.
Creativity is key, e.g.

   if test "$(id -g)" != "$( find "$MYFILE" -maxdepth 0 -printf '%G' )"; then
     echo "not my group"
   fi

Still, I think adding an example just to %G directive is not that much of help.

Have a nice day,
Berny