[zsh] remove warning using -a option of hostname

This commit is contained in:
Mathieu Maret 2011-06-09 14:00:04 +02:00
parent 8747c4dba6
commit 4aed928574
1 changed files with 11 additions and 5 deletions

16
.zshrc
View File

@ -17,10 +17,10 @@
#
# If you want to make user, host or network specific configurations,
# add your specific scripts to the folders
# - "sys:$(uname -s)" for OS-specific conf,
# - "user:$(whoami)" for user-specific conf,
# - "host:$(hostname -s)" for host-specific conf,
# - "net:$(domainname)" for network-specific conf,
# - "sys:$(uname -s)" for OS-specific conf,
# - "user:$(whoami)" for user-specific conf,
# - "host:$(hostname -s)" for host-specific conf,
# - "net:$(domainname)" for network-specific conf,
# rename your scripts to the form mentionned above, minus the "??_"
# prefix. An original script prefixed by a two-digits number SHOULD
# be present on the $ZDOTDIR folder, even if empty.
@ -37,11 +37,17 @@ USER=${USER:-`whoami`}
UID=${UID:-`id -u`}
HOST=$HOST:r
HOST=${HOST:-$(hostname -s)}
DOMAIN=${DOMAIN:-$(hostname -a | sed 's/^[^\.]*\.\?//')}
DOMAIN=${DOMAIN:-$(hostname -a 2>&-| sed 's/^[^\.]*\.\?//')}
DOMAIN=${DOMAIN:-$(hostname -d 2>&-)}
DOMAIN=${DOMAIN:-$(hostname -y 2>&-)}
[ "$DOMAIN" = "" -o "$DOMAIN" = "localdomain" -o "$DOMAIN" = "(none)" ] && DOMAIN=$(grep "^search " /etc/resolv.conf | cut -d' ' -f2)
## Agent de clefs SSH/GPG
KEYCHAIN=~/.keychain/$(hostname)-sh
[ -r "${KEYCHAIN}" ] && source ${KEYCHAIN}
[ -r "${KEYCHAIN}-gpg" ] && source ${KEYCHAIN}-gpg
DEBUG=${DEBUG:-no}
export USER HOST DOMAIN UID