[Top][All Lists]

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

[bug #56855] find -printf %h gives an empty string for the root director

From: Stephane Chazelas
Subject: [bug #56855] find -printf %h gives an empty string for the root directory '/'
Date: Tue, 3 Sep 2019 16:42:25 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #1, bug #56855 (project findutils):

There is also a case for having the empty string there. If it was the case for
%f as well, that would mean that -printf %h/%f would always be equivalent to
-printf %p

More importantly, in cases like:

find / -name foo -printf '%h/bar\0' |
  xargs -r0 cmd

that means you don't get an incorrect //bar when foo is found in /.

Remember that //foo is not guaranteed by POSIX to be the same as /foo (and in
practice is not on some systems like cygwin).

The :h and :t history modifiers of tcsh and bash (not zsh) do return the empty
string for /


Reply to this item at:


  Message sent via Savannah

reply via email to

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