mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 23:33:39 -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
|
# Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of
|
||||||
# the form [[:blank:]], and Ubuntu 18.04 LTS still uses this
|
# the form [[:blank:]], and Ubuntu 18.04 LTS still uses this
|
||||||
# 16-year-old mawk unfortunately. We need to use [ \t] instead.
|
# 16-year-old mawk unfortunately. We need to use [ \t] instead.
|
||||||
/^[ \t]*(#|$)|0\.0\.0\.0/ { next }
|
/^[ \t]*(#|$)/ { next }
|
||||||
{
|
{
|
||||||
sub(/#.*/, "")
|
sub(/#.*/, "")
|
||||||
for (i = 2; i <= NF; i++)
|
for (i = 2; i <= NF; i++)
|
||||||
print $i
|
if ($i != "0.0.0.0")
|
||||||
|
print $i
|
||||||
}
|
}
|
||||||
' /etc/hosts 2> /dev/null
|
' /etc/hosts 2> /dev/null
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -294,11 +294,12 @@ if ! declare -f __fzf_list_hosts > /dev/null; then
|
|||||||
# Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of
|
# Note: mawk <= 1.3.3-20090705 does not support the POSIX brackets of
|
||||||
# the form [[:blank:]], and Ubuntu 18.04 LTS still uses this
|
# the form [[:blank:]], and Ubuntu 18.04 LTS still uses this
|
||||||
# 16-year-old mawk unfortunately. We need to use [ \t] instead.
|
# 16-year-old mawk unfortunately. We need to use [ \t] instead.
|
||||||
/^[ \t]*(#|$)|0\.0\.0\.0/ { next }
|
/^[ \t]*(#|$)/ { next }
|
||||||
{
|
{
|
||||||
sub(/#.*/, "")
|
sub(/#.*/, "")
|
||||||
for (i = 2; i <= NF; i++)
|
for (i = 2; i <= NF; i++)
|
||||||
print $i
|
if ($i != "0.0.0.0")
|
||||||
|
print $i
|
||||||
}
|
}
|
||||||
' /etc/hosts 2> /dev/null
|
' /etc/hosts 2> /dev/null
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user