From: Nicolas Boisselier Date: Mon, 6 Feb 2017 21:33:49 +0000 (+0000) Subject: etc/profile.d/mac.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=835c0a8236a6ee923355cc6d81c1a52d5aa06d58;p=nb.git etc/profile.d/mac.sh --- diff --git a/etc/profile.d/mac.sh b/etc/profile.d/mac.sh index 09f07809..1b50cae2 100644 --- a/etc/profile.d/mac.sh +++ b/etc/profile.d/mac.sh @@ -240,4 +240,20 @@ mac_port_reinstall() { curl -s https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl | sh /tmp/myports.txt rm /tmp/myports.txt } + +not_darwin() { + case "$OSTYPE" + in darwin*) return 0 ;; + *) return 1 ;; + esac +} + +getent() { + not_darwin && (eval "$(which getent) $@"; return) + local db=$1; shift + [ "$db" != 'passwd' ] && echo "Support only passwd untill now" && return 1 + [ -z "$2" ] && (ls_users; return) + ls_users | grep "^$2:" +} + ;;esac # Darwin only ! <<<