You are not logged in.
Hi!
I'd like to understand whether one can use compgen to print an array of array of strings (ie: an array of sentences).
I know this works:
COMPREPLY=( $( compgen -W "0 1" -- ${cur}) )
and prints
"0 1".
What i'd like to achieve is something like:
"0 to disable 1 to enable"
(or, better still, breaking the line: each sentence on its own line).
Is this possible?
Thank you in advance!
Last edited by nierro (2015-12-21 12:20:28)
Offline
Use single quotes to encapsulate an "inner argument".
compgen -W "'0 to disable' '1 to enable'" -- ${cur}
However, I doubt this being what you actually want, since when used in an autocompletion script, '0' will autocomplete to '0 to disable' and '1' analogously, which your program probably cannot parse.
Offline
Yes...you're obviously right...i didn't think about that.
Thank you very much for the explanation!
Offline