From: Oleg Broytman Date: Tue, 2 Aug 2016 07:50:32 +0000 (+0300) Subject: .shellrc: test existing of programs before creating wrappers for them X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=commitdiff_plain;h=96500da2b1430bff690d368bd2f0ccec23305aa8 .shellrc: test existing of programs before creating wrappers for them --- diff --git a/.shellrc b/.shellrc index 7b362b8..2b79a64 100644 --- a/.shellrc +++ b/.shellrc @@ -165,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`" @@ -204,6 +203,7 @@ if test -n "$BASH_VERSION"; then complete -F _git_open git-open fi +fi include() { @@ -308,6 +308,7 @@ mkcd() { } +if which tmux >/dev/null 2>&1; then tmux() { case "$TERM" in rxvt) @@ -319,6 +320,7 @@ tmux() { ;; esac } +fi #if which pyenv >/dev/null 2>&1; then @@ -331,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; }