Port of Gentoo's functions.sh to other *nixes