diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2021-12-18 13:27:51 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2021-12-18 13:27:51 +0000 |
| commit | 67ef3a88f9a2dbfa13186c144296e524bce9bc48 (patch) | |
| tree | 77175bb02ce3185580d9dbf4f47961548bb32b7a /zsh/env | |
| parent | cb3233523786b2d76c7174fcd68a1b5a8ba5af3f (diff) | |
zsh: Set DOMAIN and UNAME using built-ins
Diffstat (limited to 'zsh/env')
| -rw-r--r-- | zsh/env | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 |
