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
