1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

openvpn/templates/iiab-support: Explain code paths/mechanics

This commit is contained in:
A Holt 2021-08-19 19:55:17 -04:00 committed by GitHub
parent 40379df4b8
commit 5fcc91988c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,6 +46,7 @@ if $($DEBUG); then
echo "Your OpenVPN machine name -- source: $handle"
fi
# Preview of steps (5) and (6)
echo -ne "\e[1mYour OpenVPN machine name is set to: \e[100m"
echo -n "$handle" | sed "s/^\(['\"]\)\(.*\)\1$/\2/; s/ /_/g" # Avoid '-e' interpreting backlash escapes, to show var accurately! Double quote var to prevent field splitting (eats spaces)
echo -e "\e[0m\n" # Separate line also for trailing backslash in var
@ -81,7 +82,7 @@ else
# (3) sed: Strip '# comment' on right.
ans=$(echo "$ans" | sed "s/#.*//") # Double quote var to prevent field splitting (eats spaces)
# (4) sed: Strip any outer spacing, as Ansible would do.
ans=$(echo "$ans" | sed "s/^\s*//; s/\s*$//")
ans=$(echo "$ans" | sed "s/^\s*//; s/\s*$//") # Code Safety: lstrip not nec, given "read" command above, but one day $ans might arise from elsewhere
handle=$ans; # For display at bottom
fi