X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/162d33499592d12d7c9f44c1a66f40b073eef16b..49f353d769ed62aff4d6946b344f96876a32f213:/bashrc diff --git a/bashrc b/bashrc index 6759da7..fd91584 100644 --- a/bashrc +++ b/bashrc @@ -112,6 +112,22 @@ ls () { fi } +# --- Some colour `grep' support --- + +export GREP_COLORS="mt=01;31:ms=01;31:mc=031;31:fn=36:ln=36:bn=36:se=34" + +greplike () { + declare grep=$1; shift + if [ -t 1 ]; then + command $grep ${GREP_COLORS+--color=auto} "$@" + else + command $grep "$@" + fi +} +alias grep="greplike grep" +alias egrep="greplike egrep" +alias fgrep="greplike fgrep" + # --- Set up some simple aliases --- alias cx='chmod a+x' @@ -273,6 +289,33 @@ pathhack () { fi } +# --- Switching security worlds --- + +world () { + local nfast=${NFAST_HOME-/opt/nfast} + local kmdata + case "$#" in + 0) + echo "${NFAST_KMDATA#$nfast/kmdata-}" + ;; + *) + if [ -d "$1" ]; then + kmdata=$1 + elif [ -d "$nfast/kmdata-$1" ]; then + kmdata=$nfast/kmdata-$1 + else + echo >&2 "world: can't find world $1" + return 1 + fi + shift + case "$#" in + 0) export NFAST_KMDATA=$kmdata ;; + *) "$@" ;; + esac + ;; + esac +} + # --- Fix `man' under Slowaris --- case "$MACHTYPE" in