]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
shell/env: Use test instead of [ and $HOME instead of ~.
authorSimon Ruderich <simon@ruderich.org>
Mon, 31 Dec 2012 01:10:55 +0000 (02:10 +0100)
committerSimon Ruderich <simon@ruderich.org>
Mon, 31 Dec 2012 01:10:55 +0000 (02:10 +0100)
test and $HOME are more compatible. Not all shells support [ and expand
~.

shell/env

index 2047e60a8aa5379d20b50aef8928ac0fa8d982e6..45b98bcfcf6cd2a666a14c8de347d0faf8f8fd78 100644 (file)
--- a/shell/env
+++ b/shell/env
@@ -25,14 +25,14 @@ LANG=en_US.UTF-8
 export LANG
 
 # Add ~/bin and ~/.bin and ~/.shell/bin to PATH if available.
-if [ -d ~/.shell/bin ]; then
-    PATH=~/.shell/bin:$PATH
+if test -d "$HOME/.shell/bin"; then
+    PATH="$HOME/.shell/bin:$PATH"
 fi
-if [ -d ~/bin ]; then
-    PATH=~/bin:$PATH
+if test -d "$HOME/bin"; then
+    PATH="$HOME/bin:$PATH"
 fi
-if [ -d ~/.bin ]; then
-    PATH=~/.bin:$PATH
+if test -d "$HOME/.bin"; then
+    PATH="$HOME/.bin:$PATH"
 fi
 
 # Use Vim as editor.
@@ -45,21 +45,21 @@ export PAGER
 
 # Use ~/.tmp as directory for temporary files if available to reduce security
 # problems on multi-user systems.
-if [ -O ~/.tmp -a -d ~/.tmp ]; then
-    TMP=~/.tmp
+if test -O "$HOME/.tmp" && test -d "$HOME/.tmp"; then
+    TMP=$HOME/.tmp
     TEMP=$TMP
     TMPDIR=$TMP
     export TMP TEMP TMPDIR
 # Also try ~/tmp as fallback.
-elif [ -O ~/tmp -a -d ~/tmp ]; then
-    TMP=~/tmp
+elif test -O "$HOME/tmp" && test -d "$HOME/tmp"; then
+    TMP=$HOME/tmp
     TEMP=$TMP
     TMPDIR=$TMP
     export TMP TEMP TMPDIR
 fi
 
 # Change rlwrap's home directory to prevent cluttering ~.
-RLWRAP_HOME=~/.shell/rlwrap
+RLWRAP_HOME="$HOME/.shell/rlwrap"
 export RLWRAP_HOME
 
 # Set colors for GNU ls (and zsh completions).