2017-10-24 10:22:42 +0100, Stephane Chazelas: [...] > stat implementations > #################### [...] > Only the zsh stat builtin (can be loaded as > "zstat" to avoid overriding the system's stat for those that now > have added (an incompatible) one since) can avoid the fork (if > performance is an issue). [...]
Another one that doesn't involve a fork is ast-open's ls, which can be made a ksh93 builtin. Unfortunately, for device files, it gives the dev maj/min of the device file itself instead of its st_dev: ~$ ksh -c 'command /opt/ast/bin/ls -dZ "%(dev)s" /dev/.' 000,006 ~$ ksh -c 'command /opt/ast/bin/ls -dZ "%(dev)s" /dev/sda' 008,000 It gives confusing results if you use %(dev)u or %..16(dev)u If POSIX were to specify a proper interface to lstat()/stat(), that ls -Z could be a good candidate (maybe with that %(dev)s not always giving st_dev issue fixed and a way to output NUL-delimited or shell-quoted records (-K)). -- Stephane --