diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2011-11-20 19:43:46 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2011-11-20 19:43:46 +0200 |
commit | a8218ee1c9337fc8e37431d310b5a7e95d9fbfe5 (patch) | |
tree | 07125aef0d864130cc518fd65f019fd7b242fcc7 /completions | |
parent | 811666369ec94cdc8ab841aac69824e8581ee460 (diff) | |
download | bash-completion-a8218ee1c9337fc8e37431d310b5a7e95d9fbfe5.tar.gz |
valgrind --tool: Use compgen -W instead of embedding $cur in the sed script.
$cur may contain characters that break the script, for example "/".
Diffstat (limited to 'completions')
-rw-r--r-- | completions/valgrind | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/completions/valgrind b/completions/valgrind index 56add5bb..1930c21b 100644 --- a/completions/valgrind +++ b/completions/valgrind @@ -31,10 +31,11 @@ _valgrind() --tool) # Tools seem to be named e.g. like memcheck-amd64-linux from which # we want to grab memcheck. - COMPREPLY=( $( for f in /usr{,/local}/lib{,64}/valgrind/*; do - [[ $f != *.so && -x $f ]] && - sed -ne "s/^.*\/\($cur.*\)-\([^-]*\)-\([^-]*\)/\1/p" <<<$f - done) ) + COMPREPLY=( $( compgen -W '$( + for f in /usr{,/local}/lib{,64}/valgrind/*; do + [[ $f != *.so && -x $f ]] && + sed -ne "s/^.*\/\(.*\)-\([^-]*\)-\([^-]*\)/\1/p" <<<$f + done )' -- "$cur" ) ) return ;; --sim-hints) |