-alias rm='rm -I'
-# ports
-function portpkg {
- case "$1" {
- build|run)
- sudo pkg install -AU $(make ${1}-depends-list |
- sed 's_/usr/ports/_ _' | tr -d '\n')
- ;;
- *) echo "Usage: \`portpkg <build|run>' in a port directory"
- return 1;;
- }
+if [[ "$OSTYPE" =~ '^freebsd' ]] {
+ # don't confirm if only a few files are deleted
+ alias rm='rm -I'
+} else {
+ # TODO: similar behavior for non-freebsd, or impliment in zsh
+ alias rm='rm -i'
+}
+## py venv
+alias va="source bin/activate"
+alias vd="deactivate"
+## ps
+source ~/bin/.check-busybox
+if which pstree >/dev/null 2>&1 && ! check-busybox pstree; then
+ # use pstree, but NOT busybox pstree because it kinda sucks
+ ps="pstree -wg3"
+elif [[ "$OSTYPE" =~ '^freebsd' ]]; then
+ ps="ps -aSdfxwwouser=USR -ogroup=GRP -opid,nice=NI \
+ -o%cpu,%mem,tty,stat,start=START -oetime,command"
+elif check-busybox ps; then
+ # busybox compatible
+ ps="ps -eouser='USR ' -ogroup='GRP ' \
+ -opid=' PID' -onice=' NI' -ovsz=' MEM' \
+ -otty,stat,etime,comm"
+else
+ # XXX: untested, posix
+ # TODO: support gnu ps
+ ps="ps -eouser=USR -ogroup=GRP -opid,nice=NI \
+ -opcpu=CPU -ovsz=MEM -otty,stat,etime,comm"
+fi
+unfunction check-busybox
+if [[ "$(basename "$PAGER")" = "less" ]] {
+ ps="$ps | less -S"
+} else {
+ ps="$ps | \"${PAGER:-more}\""