From ef9da6dbac2b7788a3da71fd008b87d4754ff1e1 Mon Sep 17 00:00:00 2001 From: David Alexander Majnemer Date: Tue, 13 Jan 2009 01:39:40 -0600 Subject: [PATCH] remove three bashism, over-use of [[ ]], $() and source --- bash/completion | 2 +- bash/git | 2 +- bashrc | 8 ++++---- zsh/icc | 8 ++++---- zsh/options | 1 - zsh/prompt | 2 +- zsh/title | 4 ++-- zshrc | 14 +++++++------- 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/bash/completion b/bash/completion index 162d7c6..883b676 100755 --- a/bash/completion +++ b/bash/completion @@ -1,3 +1,3 @@ for file in /etc/bash_completion /opt/local/etc/bash_completion ; do - [ -f ${file} ] && source $file && break + [ -f ${file} ] && . $file && break done diff --git a/bash/git b/bash/git index 8a47fe0..a7edcf1 100755 --- a/bash/git +++ b/bash/git @@ -1,3 +1,3 @@ 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 diff --git a/bashrc b/bashrc index 3569802..2d6a468 100644 --- a/bashrc +++ b/bashrc @@ -18,14 +18,14 @@ shopt -s histappend # update the values of LINES and COLUMNS. shopt -s checkwinsize -if [[ -d "${HOME}/.commonsh" ]] ; then +if [ -d "${HOME}/.commonsh" ] ; then for file in "${HOME}"/.commonsh/* ; do - source $file + . $file done fi -if [[ -d "${HOME}/.bash" ]] ; then +if [ -d "${HOME}/.bash" ] ; then for file in "${HOME}"/.bash/* ; do - source $file + . $file done fi diff --git a/zsh/icc b/zsh/icc index a796a54..92a299d 100755 --- a/zsh/icc +++ b/zsh/icc @@ -1,7 +1,7 @@ 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])) - if [[ -r $iccvars_path ]] ; then + if [ -r $iccvars_path ] ; then case `uname -m` in x86_64) source $iccvars_path intel64 @@ -14,9 +14,9 @@ if [[ -d "/opt/intel/Compiler" ]] ; then ;; esac 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])) - if [[ -r $iccvars_path ]] ; then + if [ -r $iccvars_path ] ; then source $iccvars_path fi fi diff --git a/zsh/options b/zsh/options index 9741a2a..f5b1bae 100755 --- a/zsh/options +++ b/zsh/options @@ -41,4 +41,3 @@ setopt HIST_IGNORE_ALL_DUPS unsetopt HIST_BEEP unsetopt EXTENDED_HISTORY - diff --git a/zsh/prompt b/zsh/prompt index 28415ae..de19ff7 100755 --- a/zsh/prompt +++ b/zsh/prompt @@ -1,5 +1,5 @@ # 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%}' RPROMPT=$'%1(j.%{\e[00;36m%}[%j].)%{\e[01;33m%}[%t]%{\e[00;00m%}' else diff --git a/zsh/title b/zsh/title index 5a010ae..4c2bc07 100755 --- a/zsh/title +++ b/zsh/title @@ -3,7 +3,7 @@ precmd() { local termtitle - termtitle=$(print -P "%n@%m") + termtitle=`print -P "%n@%m"` title zsh "$termtitle" } @@ -16,7 +16,7 @@ preexec() # Prepend this string to the title. # termtitle=$(print -P "%(!.-=*[ROOT]*=- | .)%n@%m:") - termtitle=$(print -P "%n@%m:") + termtitle=`print -P "%n@%m:"` case $cmd[1] in fg) diff --git a/zshrc b/zshrc index ff17fbd..b6cb29c 100644 --- a/zshrc +++ b/zshrc @@ -8,7 +8,7 @@ autoload -U compinit; compinit -d "${HOME}/.zsh/.zcompdump" autoload -U age autoload -U zmv -if [[ ${ZSH_VERSION//.} -gt 420 ]] ; then +if [ ${ZSH_VERSION//.} -gt 420 ] ; then autoload -U url-quote-magic zle -N self-insert url-quote-magic fi @@ -22,11 +22,11 @@ export LOGCHECK=30 export WATCHFMT=$'\e[01;36m'" -- %n@%m has %(a.Logged In.Logged out) --"$'\e[00;00m' # directory hashes -if [[ -d "${HOME}/sandbox" ]] ; then +if [ -d "${HOME}/sandbox" ] ; then hash -d sandbox="${HOME}/sandbox" fi -if [[ -d "${HOME}/work" ]] ; then +if [ -d "${HOME}/work" ] ; then hash -d work="${HOME}/work" for dir in "${HOME}"/work/*(N-/) ; do @@ -35,15 +35,15 @@ if [[ -d "${HOME}/work" ]] ; then fi # common shell utils -if [[ -d "${HOME}/.commonsh" ]] ; then +if [ -d "${HOME}/.commonsh" ] ; then for file in "${HOME}"/.commonsh/*(N.x:t) ; do - source "${HOME}/.commonsh/${file}" + . "${HOME}/.commonsh/${file}" done fi # extras -if [[ -d "${HOME}/.zsh" ]] ; then +if [ -d "${HOME}/.zsh" ] ; then for file in "${HOME}"/.zsh/*(N.x:t) ; do - source "${HOME}/.zsh/${file}" + . "${HOME}/.zsh/${file}" done fi