[Bash-completion-devel] Bug with regex for bash-completion	hosts-file
    Giordon Stark 
    kratsg at gmail.com
       
    Thu Feb 27 22:36:31 UTC 2014
    
    
  
Hey,
I used Homebrew to install bash-completion (1.3 I believe) via
    `brew install bash-completion`
and added
  if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
  fi
to my ~/.bash_profile. I noticed that some of my ssh Hosts were not
autocompleting. Inspecting it further, it appears that any host starting
with the letter 't' gets stripped for the autocompletion. I made a test
file:
    Host tier3
    User kratsg
    IdentityFile ~/.ssh/(a file)
then ran the regex against it:
sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t
'"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "testfile"
and this outputted 'ier3' rather than 'tier3' as expected. It appears the
regex is not totally valid but I've tried to debug it... and found that the
following works
sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$
"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "testfile"
outputting 'tier3' as expected. I removed the '\t ' from the block
containing the $. It seems like a bug.
Thanks and let me know,
Giordon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20140227/546e70e7/attachment.html>
    
    
More information about the Bash-completion-devel
mailing list