Add DEBUG messages for MyFqdn function
This commit is contained in:
parent
ebf03aaf8e
commit
e0e5915fde
|
@ -79,8 +79,9 @@ function IpAddress() {
|
|||
local strMyIpAddress
|
||||
strMyIpAddress=''
|
||||
strMyIpAddress=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
||||
[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Fonction IpAddress - strMyIpAddress = ${strMyIpAddress}."
|
||||
if [ "${strMyIpAddress}" == '' ]; then
|
||||
error "failed to retrieve the ip address of this machine"
|
||||
printf '\e[1;31m%-6s\e[m\n' "ERREUR : Impossible de récupérer l'adresse IP de cette machine (${strMyIpAddress})."
|
||||
return 1
|
||||
fi
|
||||
echo "{$strMyIpAddress}"
|
||||
|
@ -92,7 +93,9 @@ function MyFqdn() {
|
|||
local strMyIpAddress
|
||||
local strMyFqdn
|
||||
strMyIpAddress=$( IpAddress ) # eg '129.20.27.49'
|
||||
strMyFqdn=$(host "${strMyIpAddress}" | awk '{print $5}')
|
||||
[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Fonction MyFqdn - strMyIpAddress = ${strMyIpAddress}."
|
||||
strMyFqdn=$(host "$strMyIpAddress" | awk '{print $5}')
|
||||
[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Fonction MyFqdn - strMyFqdn = ${strMyFqdn}."
|
||||
echo "${strMyFqdn%?}" # remove the trailing '.'
|
||||
}
|
||||
## }}}
|
||||
|
|
Loading…
Reference in New Issue