mirror of
https://github.com/octoleo/hosts.git
synced 2025-01-06 07:30:42 +00:00
Add edit
command
`edit` open the hosts file in the editor specified in the $EDITOR environment variable.
This commit is contained in:
parent
fc60f3a0d7
commit
7607dfd262
@ -8,6 +8,7 @@ A program for managing host file entries.
|
|||||||
hosts add <ip> <hostname>
|
hosts add <ip> <hostname>
|
||||||
hosts remove <hostname>
|
hosts remove <hostname>
|
||||||
hosts list [127.]
|
hosts list [127.]
|
||||||
|
hosts edit
|
||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
|
13
hosts
13
hosts
@ -666,6 +666,19 @@ list() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------ edit
|
||||||
|
|
||||||
|
desc edit <<EOM
|
||||||
|
Usage: $_me edit
|
||||||
|
EOM
|
||||||
|
edit() {
|
||||||
|
if [[ -z "$EDITOR" ]]; then
|
||||||
|
_die printf "\$EDITOR not set.\n"
|
||||||
|
else
|
||||||
|
"$EDITOR" /etc/hosts
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# ---------------------------------------------------------------------- remove
|
# ---------------------------------------------------------------------- remove
|
||||||
|
|
||||||
desc remove <<EOM
|
desc remove <<EOM
|
||||||
|
Loading…
Reference in New Issue
Block a user