X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;ds=sidebyside;f=brc;h=556c5ef04e743bb2208cc54dd7ae3d7cd1569cbe;hb=6061d88c7d5beda3e974943eb8676f7c39d4ae9f;hp=f9439887573b4f0eed84950526c8ada10ae265f6;hpb=7d5e9e87105fafa2243603f958c8b41cdaa7f0ad;p=distro-setup diff --git a/brc b/brc index f943988..556c5ef 100644 --- a/brc +++ b/brc @@ -12,6 +12,18 @@ elif [[ -s ~/.iank/err ]]; then source ~/.iank/err fi +t2() { + echo t2 + popd + grep sdf sdfd + echo wtf +} +t1() { + echo t1 + trap + t2 a b c +} + # * settings CDPATH=. @@ -527,12 +539,12 @@ faf() { # find all files. use -L to follow symlinks # mail related frozen() { rm -rf /tmp/frozen - s mailq |gr frozen|awk '{print $3}' | while read -r id; do - s exim -Mvl $id + sudo mailq |gr frozen|awk '{print $3}' | while read -r id; do + sudo exim -Mvl $id echo - s exim -Mvh $id + sudo exim -Mvh $id echo - s exim -Mvb $id + sudo exim -Mvb $id echo -e '\n\n##############################\n' done | tee -a /tmp/frozen } @@ -544,7 +556,7 @@ frozenrm() { done < <(s mailq) echo "sleeping for 2 in case you change your mind" sleep 2 - s exim -Mrm "${ids[@]}" + sudo exim -Mrm "${ids[@]}" } funce() { @@ -670,7 +682,7 @@ hub() { wget -P /a/opt $up tar -C /a/opt -zxf /a/opt/$uptar rm -f /a/opt/$uptar - s /a/opt/$updir/install + sudo /a/opt/$updir/install fi # save token across computers @@ -715,7 +727,7 @@ ifn() { } ipdrop() { - s iptables -A INPUT -s $1 -j DROP + sudo iptables -A INPUT -s $1 -j DROP } @@ -930,7 +942,7 @@ rlu() { # [OPTS] HOST PATH # rync here uses checksum instead of time so we dont mess with # unison relying on time as much. g is for group, same reason # to keep up with unison. - s rsync -rlpchviog --relative "${opts[@]}" "$path" "root@$host:/"; + sudo rsync -rlpchviog --relative "${opts[@]}" "$path" "root@$host:/"; } rmstrips() { @@ -948,7 +960,7 @@ s() { # if [[ $EUID != 0 || $1 == -* ]]; then # shellcheck disable=SC2034 - SUDOD="$PWD" sudo -i "$@" + SUDOD="$PWD" command sudo -i "$@" else "$@" fi @@ -980,7 +992,7 @@ complete -F _root_command s sb ser() { - local s; [[ $EUID != 0 ]] && s=s + local s; [[ $EUID != 0 ]] && s=sudo if type -p systemctl &>/dev/null; then $s systemctl $1 $2 else @@ -1037,7 +1049,7 @@ sk() { # 2119: Functions with optional args get bad warnings when none are passed. # 2033: too many false positives for thing that will never work, passing shell function to find. # i had -x as an arg, but debian testing(stretch) doesn\'t support it - shellcheck -x -e 2086,2046,2068,2119,2033 "$@" + shellcheck -x -e 2086,2046,2068,2119,2033 "$@" || return $? # had this before. not sure what it is 2119 } @@ -1171,7 +1183,7 @@ psnetns() { local x netns netns=$1 ps -w | head -n 1 - s find -L /proc/[1-9]*/task/*/ns/net -samefile /run/netns/$netns | cut -d/ -f5 | \ + sudo find -L /proc/[1-9]*/task/*/ns/net -samefile /run/netns/$netns | cut -d/ -f5 | \ while read -r l; do x=$(ps -w --no-headers -p $l); if [[ $x ]]; then echo "$x"; else echo $l; fi; @@ -1190,10 +1202,10 @@ vm-set-listen(){ t=$(mktemp) local vm=$1 local ip=$2 - s virsh dumpxml $vm | sed -r "s/(