coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stat(1) print formats


From: Ken Irving
Subject: Re: stat(1) print formats
Date: Sat, 22 Nov 2014 14:00:39 -0900
User-agent: Mutt/1.5.20 (2009-06-14)

On Fri, Nov 21, 2014 at 12:24:22PM -0500, David Braun wrote:
> I'd like to argue that the output from the %N format from the stat(1)
> command is flawed for several reasons.
> 
> 1. The use of left and right quotes is counter to tradition and complicates
> any shell post processing of the output. All shells that I'm familiar with
> use paired quotes (left, right or double). Mixing them become difficult to
> deal with.
> 2. The use of quotes only occurs for the %N format and is only necessary
> because of the "xxx -> yyy" result because of the possibility of special
> characters in either of the xxx or yyy portions.
> 
> If instead %N merely produces the link value (the yyy part) without quotes
> (as for the %n format) then the user of the stat command has the option of
> formating the result any why she wants - almost.

I'd also be interested in having stat(1) -c or --printf formats more
suited to simple parsing in scripts.  %N is effectively a 'pretty print'
form, fairly complicated to parse, and the same might be said for %F
since it uses multiple words for some types.  If new format patterns
might be considered, I concur with the above suggestion for one that
produces just the unquoted link value (as readlink(1) would provide);
and a terse type-showing pattern, e.g., maybe using one-letter values
like find(1) -type uses.

Ken



reply via email to

[Prev in Thread] Current Thread [Next in Thread]