remove three bashism, over-use of [[ ]], $() and source

This commit is contained in:
David Alexander Majnemer 2009-01-13 01:39:40 -06:00
parent 9ed9222389
commit ef9da6dbac
8 changed files with 20 additions and 21 deletions

View file

@ -1,3 +1,3 @@
for file in /etc/bash_completion /opt/local/etc/bash_completion ; do for file in /etc/bash_completion /opt/local/etc/bash_completion ; do
[ -f ${file} ] && source $file && break [ -f ${file} ] && . $file && break
done done

View file

@ -1,3 +1,3 @@
if [ -x /usr/local/git/contrib/completion/git-completion.bash ]; then if [ -x /usr/local/git/contrib/completion/git-completion.bash ]; then
source /usr/local/git/contrib/completion/git-completion.bash . /usr/local/git/contrib/completion/git-completion.bash
fi fi

8
bashrc
View file

@ -18,14 +18,14 @@ shopt -s histappend
# update the values of LINES and COLUMNS. # update the values of LINES and COLUMNS.
shopt -s checkwinsize shopt -s checkwinsize
if [[ -d "${HOME}/.commonsh" ]] ; then if [ -d "${HOME}/.commonsh" ] ; then
for file in "${HOME}"/.commonsh/* ; do for file in "${HOME}"/.commonsh/* ; do
source $file . $file
done done
fi fi
if [[ -d "${HOME}/.bash" ]] ; then if [ -d "${HOME}/.bash" ] ; then
for file in "${HOME}"/.bash/* ; do for file in "${HOME}"/.bash/* ; do
source $file . $file
done done
fi fi

View file

@ -1,7 +1,7 @@
local iccvars_path; local iccvars_path;
if [[ -d "/opt/intel/Compiler" ]] ; then if [ -d "/opt/intel/Compiler" ] ; then
iccvars_path=$(echo /opt/intel/Compiler/11.*/*/bin/iccvars.sh(On[1])) iccvars_path=$(echo /opt/intel/Compiler/11.*/*/bin/iccvars.sh(On[1]))
if [[ -r $iccvars_path ]] ; then if [ -r $iccvars_path ] ; then
case `uname -m` in case `uname -m` in
x86_64) x86_64)
source $iccvars_path intel64 source $iccvars_path intel64
@ -14,9 +14,9 @@ if [[ -d "/opt/intel/Compiler" ]] ; then
;; ;;
esac esac
fi fi
elif [[ -d "/opt/intel/cc" ]] || [[ -d "/opt/intel/cce" ]] ; then elif [ -d "/opt/intel/cc" ] || [ -d "/opt/intel/cce" ] ; then
iccvars_path=$(echo /opt/intel/cc*/(10|9).*/bin/iccvars.sh(On[1])) iccvars_path=$(echo /opt/intel/cc*/(10|9).*/bin/iccvars.sh(On[1]))
if [[ -r $iccvars_path ]] ; then if [ -r $iccvars_path ] ; then
source $iccvars_path source $iccvars_path
fi fi
fi fi

View file

@ -41,4 +41,3 @@ setopt HIST_IGNORE_ALL_DUPS
unsetopt HIST_BEEP unsetopt HIST_BEEP
unsetopt EXTENDED_HISTORY unsetopt EXTENDED_HISTORY

View file

@ -1,5 +1,5 @@
# prompt # prompt
if [[ -z ${SSH_TTY} ]] ; then if [ -z ${SSH_TTY} ] ; then
PROMPT=$'%{\e[01;32m%}%n@%m %{\e[01;34m%}%~ %(?..%{\e[01;31m%})%(!.#.$) %{\e[00;00m%}' PROMPT=$'%{\e[01;32m%}%n@%m %{\e[01;34m%}%~ %(?..%{\e[01;31m%})%(!.#.$) %{\e[00;00m%}'
RPROMPT=$'%1(j.%{\e[00;36m%}[%j].)%{\e[01;33m%}[%t]%{\e[00;00m%}' RPROMPT=$'%1(j.%{\e[00;36m%}[%j].)%{\e[01;33m%}[%t]%{\e[00;00m%}'
else else

View file

@ -3,7 +3,7 @@ precmd()
{ {
local termtitle local termtitle
termtitle=$(print -P "%n@%m") termtitle=`print -P "%n@%m"`
title zsh "$termtitle" title zsh "$termtitle"
} }
@ -16,7 +16,7 @@ preexec()
# Prepend this string to the title. # Prepend this string to the title.
# termtitle=$(print -P "%(!.-=*[ROOT]*=- | .)%n@%m:") # termtitle=$(print -P "%(!.-=*[ROOT]*=- | .)%n@%m:")
termtitle=$(print -P "%n@%m:") termtitle=`print -P "%n@%m:"`
case $cmd[1] in case $cmd[1] in
fg) fg)

14
zshrc
View file

@ -8,7 +8,7 @@ autoload -U compinit; compinit -d "${HOME}/.zsh/.zcompdump"
autoload -U age autoload -U age
autoload -U zmv autoload -U zmv
if [[ ${ZSH_VERSION//.} -gt 420 ]] ; then if [ ${ZSH_VERSION//.} -gt 420 ] ; then
autoload -U url-quote-magic autoload -U url-quote-magic
zle -N self-insert url-quote-magic zle -N self-insert url-quote-magic
fi fi
@ -22,11 +22,11 @@ export LOGCHECK=30
export WATCHFMT=$'\e[01;36m'" -- %n@%m has %(a.Logged In.Logged out) --"$'\e[00;00m' export WATCHFMT=$'\e[01;36m'" -- %n@%m has %(a.Logged In.Logged out) --"$'\e[00;00m'
# directory hashes # directory hashes
if [[ -d "${HOME}/sandbox" ]] ; then if [ -d "${HOME}/sandbox" ] ; then
hash -d sandbox="${HOME}/sandbox" hash -d sandbox="${HOME}/sandbox"
fi fi
if [[ -d "${HOME}/work" ]] ; then if [ -d "${HOME}/work" ] ; then
hash -d work="${HOME}/work" hash -d work="${HOME}/work"
for dir in "${HOME}"/work/*(N-/) ; do for dir in "${HOME}"/work/*(N-/) ; do
@ -35,15 +35,15 @@ if [[ -d "${HOME}/work" ]] ; then
fi fi
# common shell utils # common shell utils
if [[ -d "${HOME}/.commonsh" ]] ; then if [ -d "${HOME}/.commonsh" ] ; then
for file in "${HOME}"/.commonsh/*(N.x:t) ; do for file in "${HOME}"/.commonsh/*(N.x:t) ; do
source "${HOME}/.commonsh/${file}" . "${HOME}/.commonsh/${file}"
done done
fi fi
# extras # extras
if [[ -d "${HOME}/.zsh" ]] ; then if [ -d "${HOME}/.zsh" ] ; then
for file in "${HOME}"/.zsh/*(N.x:t) ; do for file in "${HOME}"/.zsh/*(N.x:t) ; do
source "${HOME}/.zsh/${file}" . "${HOME}/.zsh/${file}"
done done
fi fi