summaryrefslogtreecommitdiff
path: root/.zsh/utils
blob: fd81acd1165fab2d538fa6cafcd1f64a9b98b36e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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