]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/functions
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 28 Feb 2019 12:14:27 +0000 (12:14 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 28 Feb 2019 12:14:27 +0000 (12:14 +0000)
etc/profile.d/functions
etc/profile.d/mac.sh

index 275431101695b34287f7257879dde94098135ca5..c7cb60e27f5ec3331ab52942482f4af94a84bf58 100755 (executable)
@@ -20,6 +20,26 @@ type -P timeout > /dev/null || timeout() {
        fi
 }
 
+type -p seq > /dev/null || seq() {
+       local begin=1
+       local end
+       local step=1
+       if [ $# = 1 ]; then
+               end="$1"
+       elif [ $# = 2 ]; then
+               begin="$1"
+               end="$2"
+       elif [ $# = 3 ]; then
+               begin="$1"
+               step="$2"
+               end="$3"
+       else
+               return 1
+       fi
+
+ awk -v begin=$begin -v end=$end -v step=$step 'BEGIN{for(i=begin;i<=end;i=i+step) {print i}}'
+}
+
 nb_repos() {
        [ -z "$FUNCNAME" ] && local FUNCNAME='nb_repos' # for busybox
        (
index 3c779bb9f17a8d810505c60a78691a371600c412..8ea58d24da53de9ae3c8fb01d1274c809fcd743d 100644 (file)
@@ -16,13 +16,13 @@ case "$OSTYPE" in darwin*)
 alias strace='dtruss'
 alias updatedb='sudo sh -c "cd / && exec /usr/libexec/locate.updatedb"'
 
-type -p seq > /dev/null || seq() {
-  if [ -n "$2" ]; then
-    jot - "$1" "$2"
-  else
-    jot "$1"
-  fi
-}
+# NB 28.02.19 type -p seq > /dev/null || seq() {
+# NB 28.02.19   if [ -n "$2" ]; then
+# NB 28.02.19     jot - "$1" "$2"
+# NB 28.02.19   else
+# NB 28.02.19     jot "$1"
+# NB 28.02.19   fi
+# NB 28.02.19 }
 
 alias mac_iptables_reload="pfctl -d; pfctl -f /etc/pf.conf -e"
 alias mac_top_proc="echo 'TOP PROCESSES:'; ps -Aro'%cpu, ucomm, user' | grep root | grep -v ' 0.0 '"