_filedir_xspec doesn't get this right: touch foobar.Z 'foo*'
compress f[TAB] => foo[TAB] => foo* foobar.Z compress foob[TAB] => nothing (as it should be, you shouldn't compress(1) a .Z) I started off looking for cases where $(command ls) could be replaced with a glob, but it only took me about 3 files before I ran into one in horrible shape, with all kinds of problems: completions/cvs. lack of quoting on variable expansions, not safe even for spaces in filenames, etc. Anyway, was working on the cvs add completion. Replaced the loop with an associative array check, but it turns out there doesn't seem to be a way to generate COMPREPLY with compgen if you have filenames with * in them, if that filename taken as a glob expression matches some other filenames. Is that right, or am I missing something? ${files[@]} is perfect up until I hit COMPREPLY=( $( compgen -X "$_backup_glob" -W '"${files[@]}"' \ -- "$cur" ) ) Then it breaks. Either glob expansion happens somewhere in there, or not enough quote-removal happens to get rid of all the quoting I had to use to stop glob expansion. printf -v files[i] %q "${files[i]}" results in foo\* in the output, then foo\\\\\* or something. '"\${files[@]}"' breaks, too. So is it just me, or is compgen generally pretty horrible to use? -- #define X(x,y) x##y Peter Cordes ; e-mail: X(peter@cor , des.ca) "The gods confound the man who first found out how to distinguish the hours! Confound him, too, who in this place set up a sundial, to cut and hack my day so wretchedly into small pieces!" -- Plautus, 200 BC
signature.asc
Description: Digital signature
_______________________________________________ Bash-completion-devel mailing list Bash-completion-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel