From 67ef3a88f9a2dbfa13186c144296e524bce9bc48 Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sat, 18 Dec 2021 13:27:51 +0000 Subject: zsh: Set DOMAIN and UNAME using built-ins --- zsh/env | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zsh/env b/zsh/env index e150338..74d96cd 100644 --- a/zsh/env +++ b/zsh/env @@ -8,9 +8,12 @@ source_if_exists() { [[ -f $(dotfiles_root)/$1 ]] && . $(dotfiles_root)/$1 || return 0 } -export DOMAIN=${$(cut -d. -f2- -s <<<${HOST}):l} +[[ ${HOST} =~ \\. ]] && export DOMAIN=${(j:.:)${(s:.:)HOST}[-2,-1]:l} export HOST=${HOST:l} -export UNAME=${$(uname):l} +case ${OSTYPE} in + darwin*) export UNAME=darwin ;; + linux*) export UNAME=linux ;; +esac setopt EXTENDED_GLOB setopt REMATCH_PCRE -- cgit v1.2.3-70-g09d2