clean up some syntax

This commit is contained in:
David Alexander Majnemer 2009-01-14 22:15:09 -05:00
parent e47c7b134a
commit 931df3e022
5 changed files with 18 additions and 30 deletions

View file

@ -3,7 +3,7 @@
# terminal fallback stuff
fix_term ()
{
if (infocmp $1 > /dev/null 2>&1) ; then
if ( infocmp $1 >/dev/null 2>&1 ) ; then
echo $1
else
case $1 in
@ -20,7 +20,7 @@ fix_term ()
fix_term screen-256colors
;;
screen-256colors)
if (infocmp xterm-256colors &> /dev/null) ; then
if ( infocmp xterm-256colors >/dev/null 2>&1 ) ; then
fix_term xterm-256colors
else
fix_term screen
@ -65,7 +65,7 @@ TERM=`fix_term $TERM`
# 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
@ -74,7 +74,6 @@ export TERM
case $TERM in
*256*)
SCREEN_TERM=$(fix_term screen-256color-bce)
alias screen="screen -T ${SCREEN_TERM}"
alias screen="screen -T `fix_term screen-256color-bce`"
;;
esac

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
[ -f "${HOME}/.dir_colors" ] && eval `$dircolors -b "${HOME}/.dir_colors"` && break
[ -f /etc/DIR_COLORS ] && eval `$dircolors -b /etc/DIR_COLORS` && break
eval `$dircolors -b` && break
@ -10,7 +10,7 @@ done
# gimmie an editor, make it a nice vi clone
for EDITOR in 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
@ -37,33 +37,22 @@ 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
alias ls="ls -h --color=auto"
else
# you have a GNU ls, surprise...
case `ls --version 2>/dev/null | head -n 1` in
*fileutils*|*coreutils*)
alias ls="ls -h --color=auto"
;;
*)
alias ls="ls -h"
;;
esac
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'
else
# woah, you have a GNU grep...
case `grep --version 2>/dev/null | head -n 1` in
*GNU*)
alias grep='grep -d skip --color=auto'
;;
esac
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
@ -73,4 +62,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,5 +1,5 @@
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

2
lock
View file

@ -1,6 +1,6 @@
#! /bin/sh
if [[ `uname -s` = 'Darwin' ]] ; then
if [ `uname -s` = 'Darwin' ] ; then
/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine
exit
fi