[zsh] Improve BSD compatibility
This commit is contained in:
parent
8fe09dc6e8
commit
d4e82cf9cd
3 changed files with 22 additions and 14 deletions
4
aliases
4
aliases
|
@ -5,7 +5,7 @@
|
||||||
# Detect if we have GNU coreutils or BSD
|
# Detect if we have GNU coreutils or BSD
|
||||||
if date --version > /dev/null 2>&1 ;then
|
if date --version > /dev/null 2>&1 ;then
|
||||||
alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars -h'
|
alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars -h'
|
||||||
alias diff='diff -u --color'
|
alias diff='diff --color'
|
||||||
alias less='less --quiet'
|
alias less='less --quiet'
|
||||||
alias grep="grep --color"
|
alias grep="grep --color"
|
||||||
alias rm='rm -I'
|
alias rm='rm -I'
|
||||||
|
@ -13,6 +13,7 @@ if date --version > /dev/null 2>&1 ;then
|
||||||
alias ipa='ip route && echo && ip --brief address'
|
alias ipa='ip route && echo && ip --brief address'
|
||||||
alias ipr='ip --brief address && echo && ip route'
|
alias ipr='ip --brief address && echo && ip route'
|
||||||
else
|
else
|
||||||
|
alias ls='ls -FGh'
|
||||||
alias ipa='ip address'
|
alias ipa='ip address'
|
||||||
alias ipa='ip route'
|
alias ipa='ip route'
|
||||||
fi
|
fi
|
||||||
|
@ -35,6 +36,7 @@ case $(uname -s) in
|
||||||
esac
|
esac
|
||||||
alias ll='ls -lha'
|
alias ll='ls -lha'
|
||||||
alias df='df -h'
|
alias df='df -h'
|
||||||
|
alias diff='diff -u'
|
||||||
alias du='du -h'
|
alias du='du -h'
|
||||||
alias feh="feh -. --auto-rotate --action1 'dragon -x %F'"
|
alias feh="feh -. --auto-rotate --action1 'dragon -x %F'"
|
||||||
alias which='which -a'
|
alias which='which -a'
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# Debugging #
|
# Debugging #
|
||||||
#############
|
#############
|
||||||
|
|
||||||
|
# Detect if we have GNU coreutils or BSD
|
||||||
|
if date --version > /dev/null 2>&1 ;then
|
||||||
# Global counter that can be used to diagnose duplicated calls
|
# Global counter that can be used to diagnose duplicated calls
|
||||||
printf "0" > /dev/shm/debug_counter
|
printf "0" > /dev/shm/debug_counter
|
||||||
debug_counter_inc() {
|
debug_counter_inc() {
|
||||||
|
@ -12,6 +14,7 @@ debug_counter_inc() {
|
||||||
debug_counter_print(){
|
debug_counter_print(){
|
||||||
printf "%d" "$(cat /dev/shm/debug_counter)"
|
printf "%d" "$(cat /dev/shm/debug_counter)"
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Update checking #
|
# Update checking #
|
||||||
|
|
5
zshrc
5
zshrc
|
@ -56,9 +56,12 @@ colors
|
||||||
. "$RC_PATH/functions"
|
. "$RC_PATH/functions"
|
||||||
. "$RC_PATH/aliases"
|
. "$RC_PATH/aliases"
|
||||||
. "$RC_PATH/prompt"
|
. "$RC_PATH/prompt"
|
||||||
|
|
||||||
|
# Detect if we have GNU coreutils or BSD
|
||||||
|
if date --version > /dev/null 2>&1 ;then
|
||||||
# Setup colors for GNU ls
|
# Setup colors for GNU ls
|
||||||
# TODO: check for GNU ls
|
|
||||||
eval "$(dircolors -b)"
|
eval "$(dircolors -b)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for rc updates in the background
|
# Check for rc updates in the background
|
||||||
(check_rc_update&) 2> /dev/null
|
(check_rc_update&) 2> /dev/null
|
||||||
|
|
Loading…
Reference in a new issue