diff options
-rw-r--r-- | .zsh/utils | 30 | ||||
-rw-r--r-- | .zsh/zstub | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/.zsh/utils b/.zsh/utils new file mode 100644 index 0000000..fd81acd --- /dev/null +++ b/.zsh/utils @@ -0,0 +1,30 @@ +# utils +# +# utility functions +# +# Copyright © 2011 Tobias Klauser <tklauser@distanz.ch> +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: git://git.distanz.ch/dotfiles/zsh.git + +# are we root? +is_root() { + test ${EUID:?} -eq 0 +} + +# are we on Mac OS X? +is_darwin() { + [[ $OSTYPE == darwin* ]] && return 0 + return 1 +} + +# are we running within an utf environment? +is_utfenv() { + case "$LANG $CHARSET $LANGUAGE" in + *utf*) return 0 ;; + *UTF*) return 0 ;; + *) return 1 ;; + esac +} + +# vim:ft=zsh @@ -11,6 +11,7 @@ source $ZDOTDIR/logging source $ZDOTDIR/sourcedir +source $ZDOTDIR/utils _DIR=$ZDOTDIR/${${(%):-%1N}#.} sourcedir $_DIR |