From 8518370e6c116c6f914961e3f52050ca3035ab44 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 8 Mar 2011 10:58:05 +0100 Subject: add utility functions --- .zsh/utils | 30 ++++++++++++++++++++++++++++++ .zsh/zstub | 1 + 2 files changed, 31 insertions(+) create mode 100644 .zsh/utils 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 +# 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 diff --git a/.zsh/zstub b/.zsh/zstub index d0c994f..e8da803 100644 --- a/.zsh/zstub +++ b/.zsh/zstub @@ -11,6 +11,7 @@ source $ZDOTDIR/logging source $ZDOTDIR/sourcedir +source $ZDOTDIR/utils _DIR=$ZDOTDIR/${${(%):-%1N}#.} sourcedir $_DIR -- cgit v1.2.3-54-g00ecf