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

index 1b50cae27e61570a0d79dd608c111a29c3e7f2d7..c72268fea1e4dc1477fef3fb58b41b647776d8b9 100644 (file)
@@ -25,8 +25,8 @@ case "$OSTYPE" in darwin*)
 alias strace='dtruss'
 alias updatedb='sudo sh -c "cd / && exec /usr/libexec/locate.updatedb"'
 
-if ! which seq 1>/dev/null; then
 seq() {
+  which seq && (eval "$(which seq) $@"; return)
   if [ -n "$2" ]; then
     jot - "$1" "$2"
   else
@@ -241,7 +241,7 @@ mac_port_reinstall() {
   rm /tmp/myports.txt
 }
 
-not_darwin() {
+is_darwin() {
   case "$OSTYPE"
     in darwin*) return 0 ;;
     *) return 1 ;;
@@ -249,9 +249,8 @@ not_darwin() {
 }
 
 getent() {
-  not_darwin && (eval "$(which getent) $@"; return)
-  local db=$1; shift
-  [ "$db" != 'passwd' ] && echo "Support only passwd untill now" && return 1
+  which getent && (eval "$(which getent) $@"; return)
+  [ "$1" != 'passwd' ] && echo "Support only passwd untill now" && return 1
   [ -z "$2" ] && (ls_users; return)
   ls_users | grep "^$2:"
 }