Skip to content

Commit

Permalink
restrict root's DIFF_OPTIONS
Browse files Browse the repository at this point in the history
possibly this was the cause of trouble during a freebsd-update
where some files in /etc were shown as zero size e.g. group
(the -N option is suspected)

Signed-off-by: Christopher Hall <hsw@ms2.hinet.net>
  • Loading branch information
hxw committed Apr 20, 2016
1 parent 798565d commit f379dbd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
30 changes: 0 additions & 30 deletions FreeBSD.zsh_local

This file was deleted.

35 changes: 32 additions & 3 deletions zshrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# .zshrc -*- mode: shell-script -*-

# determine if root user
is_root=no
[ X"0" = X"$(id -u)" ] && is_root=yes

# Tab completion
autoload -U compinit
compinit
Expand Down Expand Up @@ -148,7 +152,14 @@ case "$(uname -s)" in
alias ll='ls -l'
alias la='ls -a'
alias lc='ls -C'
alias diff='diff -urN'
case "${is_root}" in
(yes)
alias diff='diff -u'
;;
(no)
alias diff='diff -urN'
;;
esac

alias acs='apt-cache search'
alias aw='apt-cache show'
Expand Down Expand Up @@ -176,7 +187,15 @@ case "$(uname -s)" in
alias alp="netstat -an |grep --colour=never '\(^Proto.*\|LISTEN\|^udp\)'"
alias alps="netstat -aS |grep --colour=never '\(^Proto.*\|LISTEN\|^udp\)'"

export DIFF_OPTIONS=-urN
case "${is_root}" in
(yes)
export DIFF_OPTIONS=-u
;;
(no)
export DIFF_OPTIONS=-urN
;;
esac

export GREP_OPTIONS=--colour=auto
;;

Expand All @@ -195,7 +214,14 @@ case "$(uname -s)" in
alias alp="netstat -an |grep --colour=never '\(^Proto.*\|LISTEN\|^udp\)'"
alias alps="netstat -aS |grep --colour=never '\(^Proto.*\|LISTEN\|^udp\)'"

export DIFF_OPTIONS=-urN
case "${is_root}" in
(yes)
export DIFF_OPTIONS=-u
;;
(no)
export DIFF_OPTIONS=-urN
;;
esac
;;

(*)
Expand Down Expand Up @@ -262,3 +288,6 @@ if [[ -e "${HOME}/.zsh_local" ]]
then
source "${HOME}/.zsh_local"
fi

# clean up
unset is_root

0 comments on commit f379dbd

Please sign in to comment.