Conditional trailing space with bash programmable completion
问题 I'm creating a function to provide programmable completion for a command that I use (with much help from http://www.debian-administration.org/articles/317). The shell script usage is as follows: script.sh command [command options] where command can be either 'foo' or 'bar' and command options for 'foo' are 'a_foo=value' and 'b_foo=value' and command options for 'bar' are 'a_bar=value' and 'b_bar=value'. Here's the configuration I'm using: _script() { local cur command all_commands COMPREPLY=(