mirror of
https://github.com/octoleo/hosts.git
synced 2024-05-31 05:30:47 +00:00
Make list
search terms match anywhere on the line
Making list more flexible enables searching for hostnames as well as partial ip addresses.
This commit is contained in:
parent
a8461f48fd
commit
cdf7793d7e
|
@ -7,7 +7,7 @@ A command line program with shortcuts for managing hosts file entries.
|
||||||
Usage:
|
Usage:
|
||||||
hosts add <ip> <hostname>
|
hosts add <ip> <hostname>
|
||||||
hosts remove <hostname>
|
hosts remove <hostname>
|
||||||
hosts list [127.]
|
hosts list [<search string>]
|
||||||
hosts edit
|
hosts edit
|
||||||
hosts file
|
hosts file
|
||||||
|
|
||||||
|
|
2
hosts
2
hosts
|
@ -702,7 +702,7 @@ Description:
|
||||||
EOM
|
EOM
|
||||||
list() {
|
list() {
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
grep "^$1" /etc/hosts
|
grep "^[^#]*$1" /etc/hosts
|
||||||
else
|
else
|
||||||
# NOTE: use separate expressions since using a | for the or results in
|
# NOTE: use separate expressions since using a | for the or results in
|
||||||
# inconsistent behavior.
|
# inconsistent behavior.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user