Hi,

the GNU find utility does not output dollar signs embedded in filenames, i.e. 
it emits non-matching filenames!  I am pretty sure that this in not the 
intended behaviour.

I came across this when creating a command line which properly handles  
filenames with unusual characters, for which I created three test files 
starting with "ab".  Note that ls correctly outputs the dollar sign as third 
character of the second filename, but find does not:

$ ls -1q ab*
'ab"cd'\''ef()gh:;ij'
'ab'$'\n''cd'$'\t''ef*gh?jk lm'
'ab[x-y]c{1,2,3}d{4..6}e'
$ find -L . -maxdepth 1 -type f -name 'ab*' -print
./ab?cd?ef*gh?jk lm
./ab"cd'ef()gh:;ij
./ab[x-y]c{1,2,3}d{4..6}e
$ find -L . -maxdepth 1 -type f -name 'ab*' -print0 | tr '\0' '\n'
./ab
cd      ef*gh?jk lm
./ab"cd'ef()gh:;ij
./ab[x-y]c{1,2,3}d{4..6}e
$ find -L . -maxdepth 1 -type f -name 'ab*' -print0 | tr '$\0' 'A\n'
./ab
cd      ef*gh?jk lm
./ab"cd'ef()gh:;ij
./ab[x-y]c{1,2,3}d{4..6}e
$ find --version
find (GNU findutils) 4.7.0
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) 
CBO(level=2) 
$ 

-- 
Cheers,
Olf

Reply via email to