Fix the returned value of IpAddress

This commit is contained in:
Jeremy Gardais 2018-04-26 15:29:45 +02:00
parent f5ef9d67b1
commit 285aa8d6f0
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 5 additions and 5 deletions

View File

@ -84,7 +84,7 @@ function IpAddress() {
printf '\e[1;31m%-6s\e[m\n' "ERREUR: Impossible de récupérer l'adresse IP de cette machine (${strMyIpAddress})." printf '\e[1;31m%-6s\e[m\n' "ERREUR: Impossible de récupérer l'adresse IP de cette machine (${strMyIpAddress})."
return 1 return 1
fi fi
echo "{$strMyIpAddress}" echo "${strMyIpAddress}"
} }
## }}} ## }}}
@ -94,7 +94,7 @@ function MyFqdn() {
local strMyIpAddress local strMyIpAddress
local strMyFqdn local strMyFqdn
strMyIpAddress=$( IpAddress ) # eg '129.20.27.49' strMyIpAddress=$( IpAddress ) # eg '129.20.27.49'
strMyFqdn=$(host "$strMyIpAddress" | awk '{print $5}') strMyFqdn=$(host "${strMyIpAddress}" | awk '{print $5}')
echo "${strMyFqdn%?}" # remove the trailing '.' echo "${strMyFqdn%?}" # remove the trailing '.'
} }
## }}} ## }}}