On 12/13/09 5:07 AM, Freddy Vulto wrote: > `compgen -f' produces no output if the directory contains a single quote. > I get the same result on both bash-3.2.39 and bash-4.0.35. > > Steps to reproduce the problem: > > $ mkdir a\'b > $ touch a\'b/{c,d} > $ compgen -f a\'b/ > $ > > Expected output: > > a\'b/c > a\'b/d
The last time this came up, I wrote: For historical reasons, complete/compgen dequote the filename they're passed, removing backslash escapes and interpreting embedded quoted substrings. (One of the things bash should do when it does that is to be better about obeying the shell rules about backslash-escaped characters and double quotes, but that doesn't matter for this example -- though that function has several problems.) When it's called as the result of readline dispatching on a particular character, this is appropriate -- the shell hasn't done any expansion or quote removal, so the filenames still have embedded quoting. When called from the command line, as in these examples, it's not appropriate, since the shell has already expanded the argument and stripped the quotes. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/