mirror of
https://github.com/hcartiaux/dotfiles.git
synced 2024-10-18 09:15:24 +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
|
||||
unset MAILCHECK
|
||||
|
||||
# Configure a set of useful variables
|
||||
if [[ -e /proc/sys/kernel/hostname ]] ; then
|
||||
FQDN=$(cat /proc/sys/kernel/hostname)
|
||||
elif [[ "$(echo "$UNAME" | grep -c -i -e '^.*bsd$')" == "1" ]] ; then
|
||||
FQDN=$(hostname)
|
||||
if [[ $(echo $HOSTNAME | grep -c \\.) != 0 ]] ; then
|
||||
FQDN=$HOSTNAME
|
||||
else
|
||||
FQDN=$(hostname -f)
|
||||
fi
|
||||
|
||||
DOMAIN=$(echo "$FQDN" | cut -d '.' -f 2)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue