bug-findutils
[Top][All Lists]
Advanced

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

find -print output escaping not documented?


From: Bob Proulx
Subject: find -print output escaping not documented?
Date: Fri, 10 Jan 2014 13:20:47 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Undocumented behavior.  Here is the test case:

mkdir /tmp/testdir
mkdir /tmp/testdir/"newline
newline"

find /tmp/testdir -print
/tmp/testdir
/tmp/testdir/newline?newline

Note the '?' in the above.  No '?' in the below that is redirected.

find /tmp/testdir -print | head
/tmp/testdir
/tmp/testdir/newline
newline

If stdout is a tty then the newline is mapped to '?'.  But it isn't
mapped if the output is redirected to a pipe or a file.  This applies
to the printf %p format too.

This behavior appears to be undocumented.  At least I couldn't find a
reference to behavior differences based upon the output being a tty or
not.

I looked over  
http://pubs.opengroup.org/onlinepubs/009695399/utilities/find.html 
and couldn't find anything allowing this behavior either.

Did that character mapping sneak in unintentionally?

Thanks,
Bob

P.S. I am well aware of -print0 and friends.



reply via email to

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