[Bash-completion-devel] mount label|uuid
Ville Skyttä
ville.skytta at iki.fi
Mon Apr 13 20:04:02 UTC 2009
On Sunday 12 April 2009, gibboris at gmail.com wrote:
> COMPREPLY=( $( sed -n "/UUID/s/^UUID=\($cur[0-9a-f-]\{,36\}\).*/\1/Ip"
/etc/fstab ) )
I think this would be better put as:
COMPREPLY=( $( compgen -W '$( sed -ne "s/^UUID=\([^[:space:]]*\).*/\1/p"
/etc/fstab )' -- $cur ) )
"compgen -W ... -- $cur" is safer against unusual characters in $cur, and "I"
in sed's s///I only works with GNU sed as far as I know.
> COMPREPLY=( $( sed -n "/LABEL/s/^LABEL=\($cur[0-9a-z_]*\).*/\1/Ip"
/etc/fstab ) )
Ditto here:
COMPREPLY=( $( compgen -W '$( sed -ne "s/^LABEL=\([^[:space:]]*\).*/\1/p"
/etc/fstab )' -- $cur ) )
Could you test these changes and submit a new patch if they work for you?
More information about the Bash-completion-devel
mailing list