0

How to create a bash completion script that contains spaces in the argument, the following work nicely as long as the args are space separated, but I couldn't make it work with args that contain spaces and are separated by a new line or the like

_api(){
...
COMPREPLY=( $( compgen -W "$args"  -- "$cur" ) )
...
}
complete -F _api ./command
1

Do the following:

_api(){
...
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$args"  -- "$cur" ) )
...
}
complete -F _api ./command
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.