From: Nicolas Boisselier Date: Thu, 28 Feb 2019 12:14:27 +0000 (+0000) Subject: etc/profile.d/functions X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=347dbee308b2f8a7e801ab6e643c9a8c211ee2be;p=nb.git etc/profile.d/functions --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 27543110..c7cb60e2 100755 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -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 ( diff --git a/etc/profile.d/mac.sh b/etc/profile.d/mac.sh index 3c779bb9..8ea58d24 100644 --- a/etc/profile.d/mac.sh +++ b/etc/profile.d/mac.sh @@ -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 '"