[Bash-completion-devel] Bug with regex for bash-completion hosts-file

Giordon Stark kratsg at gmail.com
Fri Feb 28 07:11:20 UTC 2014


Hey all - it appears that the problem lies with BSD sed and Mac OSX's sed
doesn't support tabs in the same way as you're using them.

I've talked with some homebrew people - we're going to see if we can't
alias your sed to use gnu-sed (for os x).

G


On Thu, Feb 27, 2014 at 4:36 PM, Giordon Stark <kratsg at gmail.com> wrote:

> 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/20140228/3e95ecd3/attachment.html>


More information about the Bash-completion-devel mailing list