From a61236ff13d51d40b21549f8339e701d76db6ec2 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 Nov 2025 22:02:48 +0000 Subject: [PATCH] Adding some comments and echo for -sh --- generator-hosts.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/generator-hosts.sh b/generator-hosts.sh index 977712a..8b344d7 100755 --- a/generator-hosts.sh +++ b/generator-hosts.sh @@ -295,32 +295,41 @@ create_host() { _build_hosts_file() { out="$1" if [ "$out" = "-" ]; then + echo "# --- localhost generate ---#" printf "127.0.0.1" refresh_arrays for a in "${alias_names[@]}"; do printf " %s" "$a" done printf "\n\n" + echo "# --- main not dynamic part --- #" [ -f "$MAINFOLD/main.conf" ] && sed -n '1,200p' "$MAINFOLD/main.conf" && printf "\n" refresh_arrays + echo "# --- dynamic hosts --- #" for en in "${en_files[@]}"; do [ -f "$ENFOLD/$en.conf" ] && sed -n '1,500p' "$ENFOLD/$en.conf" && printf "\n" done + echo "# --- end part ---#" [ -f "$MAINFOLD/endfile.conf" ] && sed -n '1,200p' "$MAINFOLD/endfile.conf" && printf "\n" else tmp="$out" : > "$tmp" + echo "# --- localhost generate ---#" >> $tmp printf "127.0.0.1" >> "$tmp" refresh_arrays for a in "${alias_names[@]}"; do printf " %s" "$a" >> "$tmp" done printf "\n\n" >> "$tmp" + echo "# --- main not dynamic part --- #" >> $tmp [ -f "$MAINFOLD/main.conf" ] && sed -n '1,200p' "$MAINFOLD/main.conf" >> "$tmp" && printf "\n" >> "$tmp" refresh_arrays + echo "# --- dynamic hosts --- #" >> $tmp for en in "${en_files[@]}"; do [ -f "$ENFOLD/$en.conf" ] && sed -n '1,500p' "$ENFOLD/$en.conf" >> "$tmp" && printf "\n" >> "$tmp" done + + echo "# --- end part ---#" >> $tmp [ -f "$MAINFOLD/endfile.conf" ] && sed -n '1,200p' "$MAINFOLD/endfile.conf" >> "$tmp" && printf "\n" >> "$tmp" fi } @@ -342,7 +351,9 @@ regenerate_hosts() { } simulate_hosts() { - _build_hosts_file "-" + echo "###### HOST SIMULATION ######" + _build_hosts_file "-" + echo "###### HOST OVER ######" } #### RUN ####