mirror of
https://github.com/octoleo/hosts.git
synced 2025-01-04 06:37:39 +00:00
Use alpha ordering for function definitions
This commit is contained in:
parent
f7ed234951
commit
a8461f48fd
40
hosts
40
hosts
@ -660,26 +660,6 @@ add() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------ list
|
|
||||||
|
|
||||||
desc list <<EOM
|
|
||||||
Usage:
|
|
||||||
$_me list [127.]
|
|
||||||
|
|
||||||
Description:
|
|
||||||
List the existing IP / hostname pairs. When provided with the beginning of
|
|
||||||
an IP address, lists the pairs with matching IP addresses.
|
|
||||||
EOM
|
|
||||||
list() {
|
|
||||||
if [[ -n "$1" ]]; then
|
|
||||||
grep "^$1" /etc/hosts
|
|
||||||
else
|
|
||||||
# NOTE: use separate expressions since using a | for the or results in
|
|
||||||
# inconsistent behavior.
|
|
||||||
grep -v -e '^$' -e '^\s*\#' /etc/hosts
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------ edit
|
# ------------------------------------------------------------------------ edit
|
||||||
|
|
||||||
desc edit <<EOM
|
desc edit <<EOM
|
||||||
@ -710,6 +690,26 @@ file() {
|
|||||||
cat /etc/hosts
|
cat /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------ list
|
||||||
|
|
||||||
|
desc list <<EOM
|
||||||
|
Usage:
|
||||||
|
$_me list [127.]
|
||||||
|
|
||||||
|
Description:
|
||||||
|
List the existing IP / hostname pairs. When provided with the beginning of
|
||||||
|
an IP address, lists the pairs with matching IP addresses.
|
||||||
|
EOM
|
||||||
|
list() {
|
||||||
|
if [[ -n "$1" ]]; then
|
||||||
|
grep "^$1" /etc/hosts
|
||||||
|
else
|
||||||
|
# NOTE: use separate expressions since using a | for the or results in
|
||||||
|
# inconsistent behavior.
|
||||||
|
grep -v -e '^$' -e '^\s*\#' /etc/hosts
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# ---------------------------------------------------------------------- remove
|
# ---------------------------------------------------------------------- remove
|
||||||
|
|
||||||
desc remove <<EOM
|
desc remove <<EOM
|
||||||
|
Loading…
Reference in New Issue
Block a user