[pve-devel] Suggest hostnames in bash completion

Dietmar Maurer dietmar at proxmox.com
Mon Jul 18 19:22:46 CEST 2016

> I can see an easy solution in the form of coprocesses[1]. The autocomplete
> bash function would spawn the command on demand as a coprocess and then
> communicate with it over private pipes, with a simple text protocol. For
> example: send one line with the text the user typed; receive one line with all
> the completions separated by space. As an added bonus, exiting or killing the
> shell would terminate the coprocess.
> [1] https://tiswww.case.edu/php/chet/bash/bashref.html#SEC23
> Example:
> $ coproc REV { stdbuf -i0 -o0 -e0 rev; }
> [1] 27168
> $ echo hello >&${REV[1]}
> $ read line  <&${REV[0]}; echo $line
> olleh
> $ echo world >&${REV[1]}
> $ read line  <&${REV[0]}; echo $line
> dlrow

This would span one coproc per bash/terminal session? I guess that is a bit too

More information about the pve-devel mailing list