mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 15:23:48 -05:00
[bash,zsh] Correctly exclude the hostname "0.0.0.0"
In the current implementation, any hostnames in /etc/hosts containing "0.0.0.0" as a part (such as "110.0.0.0" would be excluded. "0.0.0.0" should be checked by the exact match.
This commit is contained in:
committed by
Junegunn Choi
parent
585cfaef8b
commit
adc9ad28da
@@ -516,11 +516,12 @@ if ! declare -F __fzf_list_hosts > /dev/null; then
|
||||
# Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of
|
||||
# the form [[:blank:]], and Ubuntu 18.04 LTS still uses this
|
||||
# 16-year-old mawk unfortunately. We need to use [ \t] instead.
|
||||
/^[ \t]*(#|$)|0\.0\.0\.0/ { next }
|
||||
/^[ \t]*(#|$)/ { next }
|
||||
{
|
||||
sub(/#.*/, "")
|
||||
for (i = 2; i <= NF; i++)
|
||||
print $i
|
||||
if ($i != "0.0.0.0")
|
||||
print $i
|
||||
}
|
||||
' /etc/hosts 2> /dev/null
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user