summaryrefslogtreecommitdiff
path: root/zsh/env
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2021-12-18 13:27:51 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2021-12-18 13:27:51 +0000
commit67ef3a88f9a2dbfa13186c144296e524bce9bc48 (patch)
tree77175bb02ce3185580d9dbf4f47961548bb32b7a /zsh/env
parentcb3233523786b2d76c7174fcd68a1b5a8ba5af3f (diff)
zsh: Set DOMAIN and UNAME using built-ins
Diffstat (limited to 'zsh/env')
-rw-r--r--zsh/env7
1 files 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