]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/mac.sh
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 6 Feb 2017 21:33:49 +0000 (21:33 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 6 Feb 2017 21:33:49 +0000 (21:33 +0000)
etc/profile.d/mac.sh

index 09f07809e5731f583cf62a6e1fd8267c359fdafa..1b50cae27e61570a0d79dd608c111a29c3e7f2d7 100644 (file)
@@ -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 ! <<<