metrics.sh/lib/utils.sh

19 lines
391 B
Bash
Raw Normal View History

2015-02-22 18:36:04 +01:00
#!/bin/sh
2015-02-21 18:18:27 +01:00
# http://stackoverflow.com/a/1369211/183097
copy_function () {
declare -F $1 > /dev/null || return 1
eval "$(echo "${2}()"; declare -f ${1} | tail -n +2)"
2015-02-21 18:49:18 +01:00
}
is_function () {
[ "`type -t $1`" == 'function' ]
2015-02-22 18:36:04 +01:00
}
OS_TYPE=$(case "$OSTYPE" in
(solaris*) echo solaris;;
(darwin*) echo osx;;
(linux*) echo linux;;
(bsd*) echo bsd;;
(*) echo unknown;;
esac)