mirror of
https://github.com/hcartiaux/dotfiles.git
synced 2024-10-18 17:25:23 +02:00
[bash] Get the FQDN from the HOSTNAME env variable if possible
This commit is contained in:
parent
5afcdae976
commit
4f16ae76ee
1 changed files with 3 additions and 5 deletions
|
@ -32,14 +32,12 @@ export LANG LANGUAGE LC_CTYPE LC_ALL
|
||||||
# Get rid of mail notification
|
# Get rid of mail notification
|
||||||
unset MAILCHECK
|
unset MAILCHECK
|
||||||
|
|
||||||
# Configure a set of useful variables
|
if [[ $(echo $HOSTNAME | grep -c \\.) != 0 ]] ; then
|
||||||
if [[ -e /proc/sys/kernel/hostname ]] ; then
|
FQDN=$HOSTNAME
|
||||||
FQDN=$(cat /proc/sys/kernel/hostname)
|
|
||||||
elif [[ "$(echo "$UNAME" | grep -c -i -e '^.*bsd$')" == "1" ]] ; then
|
|
||||||
FQDN=$(hostname)
|
|
||||||
else
|
else
|
||||||
FQDN=$(hostname -f)
|
FQDN=$(hostname -f)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DOMAIN=$(echo "$FQDN" | cut -d '.' -f 2)
|
DOMAIN=$(echo "$FQDN" | cut -d '.' -f 2)
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue