speed up shells massively

This commit is contained in:
David Majnemer 2010-09-02 11:49:57 -05:00
parent c0851b91a3
commit 068b62e00d
8 changed files with 31 additions and 31 deletions

View file

@ -45,7 +45,7 @@ if [ -z "${MANPATH}" ] ; then
case `uname -s` in
SunOS)
# some solaris systems have manpath
if ( command -v manpath >/dev/null 2>&1 ) ; then
if command -v manpath >/dev/null 2>&1 ; then
MANPATH=`manpath`
export MANPATH
else

View file

@ -4,7 +4,7 @@
fix_term ()
{
# we were requested to go on screen and we are on a mac
if ( infocmp $1 >/dev/null 2>&1 ) ; then
if infocmp $1 >/dev/null 2>&1 ; then
echo $1
else
case $1 in
@ -21,7 +21,7 @@ fix_term ()
fix_term screen-256colors
;;
screen-256colors)
if ( infocmp xterm-256colors >/dev/null 2>&1 ) ; then
if infocmp xterm-256colors >/dev/null 2>&1 ; then
fix_term xterm-256colors
else
fix_term screen
@ -52,7 +52,7 @@ fix_terminfo_db ()
fi
}
if ( command -v infocmp >/dev/null 2>&1 ) ; then
if command -v infocmp >/dev/null 2>&1 ; then
# terminal surgery
case `uname -s` in
Interix)
@ -70,7 +70,7 @@ if ( command -v infocmp >/dev/null 2>&1 ) ; then
# I am sorry to hear that you are running an
# xterm that has no colors (I am looking at you solaris)
if [ $TERM = xterm ] && ( command -v tput >/dev/null 2>&1 ) && [ `tput -T xterm colors` = -1 ] ; then
if [ $TERM = xterm ] && command -v tput >/dev/null 2>&1 && [ `tput -T xterm colors` = -1 ] ; then
# lets see what we can do about your terrible term
TERM=`fix_term xterm-color`
fi

View file

@ -1,7 +1,7 @@
#! /bin/sh
# colors
for dircolors in gdircolors dircolors ; do
if ( command -v $dircolors >/dev/null 2>&1 ) ; then
if command -v $dircolors >/dev/null 2>&1 ; then
dircolor_text=''
if [ -f "${HOME}/.dir_colors" ] ; then
dircolor_text=`cat "${HOME}/.dir_colors"`
@ -11,7 +11,7 @@ for dircolors in gdircolors dircolors ; do
eval `$dircolors -b /etc/DIR_COLORS`
fi
if ( $dircolors --version 2>/dev/null | grep GNU >/dev/null 2>&1 ) ; then
if $dircolors --version 2>/dev/null | grep GNU >/dev/null 2>&1 ; then
dircolor_text="${dircolor_text}\nSTICKY_OTHER_WRITABLE 01;04;34;40"
dircolor_text="${dircolor_text}\nOTHER_WRITABLE 01;34;40"
fi
@ -23,7 +23,7 @@ done
# gimmie an editor, make it a nice vi clone
for EDITOR in vimx vim elvis vile nvi vi ; do
( command -v $EDITOR >/dev/null 2>&1 ) && break
command -v $EDITOR >/dev/null 2>&1 && break
done
export EDITOR
@ -46,13 +46,13 @@ case `uname -s` in
alias grep='grep -d skip --color=auto'
;;
FreeBSD|Darwin|DragonFly)
if ( command -v top >/dev/null 2>&1 ) ; then
if command -v top >/dev/null 2>&1 ; then
alias top="top -o cpu"
fi
if ( command -v gls >/dev/null 2>&1 ) ; then
if command -v gls >/dev/null 2>&1 ; then
alias ls="gls -h --color=auto"
elif ( ls --version 2>/dev/null | grep GNU >/dev/null 2>&1 ) ; then
elif ls --version 2>/dev/null | grep GNU >/dev/null 2>&1 ; then
alias ls="ls -h --color=auto"
else
LSCOLORS="ExGxFxDxCxDxDxHbaDEaEa"
@ -65,31 +65,31 @@ case `uname -s` in
alias ls="ls --color"
;;
SunOS)
if ( command -v gls >/dev/null 2>&1 ) ; then
if command -v gls >/dev/null 2>&1 ; then
alias ls="gls -h --color=auto"
elif ( ls --version 2>/dev/null | grep GNU >/dev/null 2>&1 ) ; then
elif ls --version 2>/dev/null | grep GNU >/dev/null 2>&1 ; then
alias ls="ls -h --color=auto"
else
alias ls="ls -h"
fi
if ( command -v ggrep >/dev/null 2>&1 ) ; then
if command -v ggrep >/dev/null 2>&1 ; then
alias grep='ggrep -d skip --color=auto'
elif ( grep --version 2>/dev/null | grep GNU >/dev/null 2>&1 ) ; then
elif grep --version 2>/dev/null | grep GNU >/dev/null 2>&1 ; then
alias grep='grep -d skip --color=auto'
fi
for locate in glocate slocate ; do
( command -v $locate >/dev/null 2>&1 ) && alias locate=$locate
command -v $locate >/dev/null 2>&1 && alias locate=$locate
done
;;
esac
if ( command -v gobjdump >/dev/null 2>&1 ) ; then
if command -v gobjdump >/dev/null 2>&1 ; then
alias objdump=gobjdump
fi
if ( command -v ack-grep >/dev/null 2>&1 ) ; then
if command -v ack-grep >/dev/null 2>&1 ; then
alias ack=ack-grep
fi
@ -100,4 +100,4 @@ alias du='du -h'
alias ping='ping -c4'
( command -v time >/dev/null 2>&1 ) && alias time='command time'
command -v time >/dev/null 2>&1 && alias time='command time'

View file

@ -1,6 +1,6 @@
#! /bin/sh
for PAGER in less more pg ; do
( command -v $PAGER >/dev/null 2>&1 ) && break
command -v $PAGER >/dev/null 2>&1 && break
done
export PAGER

View file

@ -1,4 +1,4 @@
#! /bin/sh
for wrap in rlwrap rlfe cle ; do
( command -v $wrap >/dev/null 2>&1 ) && alias ocaml="$wrap ocaml" && break
command -v $wrap >/dev/null 2>&1 && alias ocaml="$wrap ocaml" && break
done

View file

@ -14,13 +14,13 @@ err ()
E*)
errconst=$1
unset errno
if [ "${errno}" = "" ] && ( command -v python > /dev/null 2>&1 ); then
if [ "${errno}" = "" ] && command -v python > /dev/null 2>&1 ; then
errno=`python -c "import errno;print(errno.${errconst})" 2>/dev/null`
fi
if [ "${errno}" = "" ] && ( command -v perl > /dev/null 2>&1 ); then
if [ "${errno}" = "" ] && command -v perl > /dev/null 2>&1 ; then
errno=`perl -MErrno -e "print &Errno::${errconst}.\"\n\";" 2>/dev/null`
fi
if [ "${errno}" = "" ] && ( command -v ruby > /dev/null 2>&1 ); then
if [ "${errno}" = "" ] && command -v ruby > /dev/null 2>&1 ; then
errno=`ruby -e "puts Errno::${errconst}::Errno" 2>/dev/null`
fi
if [ "${errno}" = "" ] && [ -e /usr/include/errno.h ] ; then
@ -36,10 +36,10 @@ err ()
*)
errno=$1
unset errconst
if [ "${errconst}" = "" ] && ( command -v ruby > /dev/null 2>&1 ); then
if [ "${errconst}" = "" ] && command -v ruby > /dev/null 2>&1 ; then
errconst=`ruby -e "puts Errno.constants.find_all{|err| eval('Errno::' + err + '::Errno') == ${errno} }" 2>/dev/null`
fi
if [ "${errconst}" = "" ] && ( command -v python > /dev/null 2>&1 ); then
if [ "${errconst}" = "" ] && command -v python > /dev/null 2>&1 ; then
errconst=`python -c "import errno;print(errno.errorcode[${errno}])" 2>/dev/null`
fi
if [ "${errconst}" ] ; then
@ -58,10 +58,10 @@ err ()
esac
unset errstr
if [ "${errstr}" = "" ] && ( command -v perl > /dev/null 2>&1 ) ; then
if [ "${errstr}" = "" ] && command -v perl > /dev/null 2>&1 ; then
errstr=`perl -MPOSIX -e 'print strerror($ARGV[0])."\n";' $errno`
fi
if [ "${errstr}" = "" ] && ( command -v python > /dev/null 2>&1 ) ; then
if [ "${errstr}" = "" ] && command -v python > /dev/null 2>&1 ; then
errstr=`python -c "import os;print(os.strerror($errno))" 2>/dev/null`
fi
@ -89,7 +89,7 @@ extract ()
return
fi
if ( command -v aunpack > /dev/null 2>&1 ) ; then
if command -v aunpack > /dev/null 2>&1 ; then
aunpack "${1}"
return
fi

View file

@ -2,7 +2,7 @@
WORDCHARS=''
# disable core dumps
if ( ulimit -c >/dev/null 2>&1 ) ; then
if ulimit -c >/dev/null 2>&1 ; then
ulimit -c 0
fi

View file

@ -21,7 +21,7 @@ case "${TERM}" in
dumb)
;;
*)
if ( command -v tput >/dev/null 2>&1 ) && [ `tput colors` != -1 ] ; then
if command -v tput >/dev/null 2>&1 && [ `tput colors` != -1 ] ; then
RESETCOLOR=$'%{\e[00;00m%}'
if [ -z "${SSH_TTY}" ] ; then
HOSTCOLOR=$'%{\e[01;32m%}'