From 4194b254590b9d2ae102a0253269c9ed256ee38c Mon Sep 17 00:00:00 2001 From: William Melody Date: Wed, 1 Mar 2017 11:42:26 -0800 Subject: [PATCH] Use `HEREDOC` rather than `EOM` to define heredocs. --- hosts | 68 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/hosts b/hosts index c3d2771..6e40fef 100755 --- a/hosts +++ b/hosts @@ -510,9 +510,9 @@ sudo !!\n" # implementation and simplicity. There is an alternative assignment form # that could be used here: # -# var="$(cat <<'EOM' +# var="$(cat <<'HEREDOC' # some message -# EOM +# HEREDOC # ) # # However, this form appears to require trailing space after backslases to @@ -523,9 +523,9 @@ desc() { [[ -z ${1} ]] && _die printf "desc: No command name specified.\n" if [[ -n ${2:-} ]] then - read -d '' "_desc_${1}" <] Description: Display help information for ${_ME} or a specified command. -EOM +HEREDOC help() { if [[ ${#_COMMAND_ARGV[@]} = 1 ]] then - cat <] $(commands) -EOM +HEREDOC else _print_desc "${1}" fi @@ -624,7 +624,7 @@ EOM # Command List ################################################################ -desc "commands" < [] Description: Add a given IP address and hostname pair, along with an optional comment. -EOM +HEREDOC add() { _debug printf "add() \${1}: %s\n" "${1:-}" _debug printf "add() \${2}: %s\n" "${2:-}" @@ -731,14 +731,14 @@ add() { # --------------------------------------------------------------------- disable -desc "disable" < | | ) Description: Disable one or more records based on a given ip address, hostname, or search string. -EOM +HEREDOC disable() { _verify_write_permissions local search_string="${1}" @@ -785,26 +785,26 @@ disable() { # -------------------------------------------------------------------- disabled -desc "disabled" < | | ) Description: Enable one or more disabled records based on a given ip address, hostname, or search string. -EOM +HEREDOC enable() { _verify_write_permissions local search_string="${1}" @@ -871,33 +871,33 @@ enable() { # --------------------------------------------------------------------- enabled -desc "enabled" <] @@ -905,7 +905,7 @@ Description: List the existing IP / hostname pairs, optionally limited to a specified state. When provided with a seach string, all matching enabled records will be printed. -EOM +HEREDOC list() { # Get the disabled records up front for the two cases where they are needed. local disabled_records @@ -937,7 +937,7 @@ list() { # ---------------------------------------------------------------------- remove -desc "remove" < | | ) [--force] ${_ME} remove @@ -949,7 +949,7 @@ Description: Remove one or more records based on a given IP address, hostname, or search string. If an IP and hostname are both provided, only records matching the IP and hostname pair will be removed. -EOM +HEREDOC remove() { _verify_write_permissions local is_search_pair=0 @@ -1072,13 +1072,13 @@ remove() { # ------------------------------------------------------------------------ show -desc "show" < | | ) Description: Print entries matching a given IP address, hostname, or search string. -EOM +HEREDOC show() { if [[ -n "${1}" ]] then