]> git.phdru.name Git - dotfiles.git/blobdiff - .shellrc
.shellrc: test existing of programs before creating wrappers for them
[dotfiles.git] / .shellrc
index 90442e0e097a1672970e1cd2260b9ce0be7ba597..2b79a64297134e4e29e55d84a995a780729b3fd3 100644 (file)
--- a/.shellrc
+++ b/.shellrc
@@ -15,6 +15,7 @@ esac
 # Stop if non-interactive shell
 # [ -z "$PS1" ] && return
 
+if test -n "$BASH_VERSION"; then
 # append to the history file, don't overwrite it
 shopt -s histappend
 
@@ -25,6 +26,7 @@ shopt -s checkwinsize
 # If set, the pattern "**" used in a pathname expansion context will
 # match all files and zero or more directories and subdirectories.
 #shopt -s globstar
+fi
 
 
 #if [ -x /usr/bin/dircolors ]; then
@@ -163,8 +165,7 @@ KillAll() {
 }
 
 
-# git-related
-
+if test -x /usr/bin/git >/dev/null 2>&1; then
 # chdir to a remote's directory (if the remote is on the local FS)
 cdremote() {
    cd "`git config --get remote.$1.url`"
@@ -202,6 +203,7 @@ if test -n "$BASH_VERSION"; then
 
    complete -F _git_open git-open
 fi
+fi
 
 
 include() {
@@ -306,6 +308,7 @@ mkcd() {
 }
 
 
+if which tmux >/dev/null 2>&1; then
 tmux() {
    case "$TERM" in
       rxvt)
@@ -317,6 +320,7 @@ tmux() {
       ;;
    esac
 }
+fi
 
 
 #if which pyenv >/dev/null 2>&1; then
@@ -329,5 +333,8 @@ if [ -f /usr/local/bin/virtualenvwrapper_lazy.sh ]; then
 fi
 
 
+if [ "$SHLVL" -eq 1 ] && which startx >/dev/null 2>&1; then
 X() { startx >> .Xserver.log 2>&1; cyr; }
+fi
+
 x() { exit; }