bash-completion-tutorial icon indicating copy to clipboard operation
bash-completion-tutorial copied to clipboard

Word splitting taking place

Open pesathem opened this issue 7 years ago • 1 comments

Your code relies on word splitting suggestions=( $(compgen ... ) ) and the completion gives me wrong results before you set IFS=$'\n'. When you tested your function, you might have had IFS set from some previous attempts (since compgen also splits using IFS, I believe that really is the case). It's also subject to pathname expansion which is not that important here but still might be an issue in some extreme cases. set -f might be a good idea.

I believe that creating a completion that correctly handles whitespace characters and globs is extremely painful. I may have missed something of course and I might embarrass myself :) Overall it's a great article giving insight in some less known parts of bash :+1:

ezgif-4-dcfe42fdea

pesathem avatar Jul 11 '18 18:07 pesathem

@pesathem Hi there and sorry for the late response!

I will check what you reported and I will get back to you asap. Thank you very much for your feedback!

iridakos avatar Aug 30 '18 07:08 iridakos