Commit e02179c2 authored by nimrod's avatar nimrod
Browse files

Rewrote prune_prerun (prune prerun files used to time shell commands) because...

Rewrote prune_prerun (prune prerun files used to time shell commands) because grep on OpenBSD doesn't have support for null-terminated strings.
parent 4d495231
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ alias unssh="ssh -o \"UserKnownHostsFile /dev/null\" -o \"StrictHostKeyChecking
alias todo="vim \$HOME/Documents/TODO.yml"
alias sudo="sudo "
alias presentation='docker dev adarnimrod/presentation'
alias prune_prerun='find "$HOME" -maxdepth 1 -name ".prerun.*" -print0 | grep -zv "$(pgrep -u "$(id -u)" bash)" | xargs -0r rm '
alias netdata='docker run --detach --name netdata --cap-add SYS_PTRACE --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /var/run/docker.sock:/var/run/docker.sock --publish 19999:19999 firehol/netdata'
alias json-tool='python3 -m json.tool'
alias jt='json-tool'
@@ -92,6 +91,14 @@ alias dd='dd status=progress'
alias screenshot-cleanup='find "$HOME/Pictures" -name "Screenshot from *.png" -delete'
alias bell='printf \a'

prune_prerun () {
    local shell_procs="$(pgrep -u "$(id -u)" "$(basename $SHELL)")"
    for file in $HOME/.prerun.*
    do
        echo "file" | grep -qv "$shell_procs" || rm "$file"
    done
}

bold () {
    printf '\e[1m'
    echo "$@"