1
0
mirror of https://github.com/meineerde/dotfiles.git synced 2025-10-17 19:41:01 +00:00

Make .bashrc work in non-interactive environments

This commit is contained in:
Holger Just 2011-05-12 22:39:37 +02:00
parent 41ccb0d38e
commit 9883b28ea3

24
.bashrc
View File

@ -52,9 +52,6 @@ if [[ !`which install_ruby 2>/dev/null` ]] && [[ `which ruby 2>/dev/null` ]]; th
export RUBY_VERSION=$(ruby --version | sed -e "s/^ruby \(.\..\..\).*$/\1/") export RUBY_VERSION=$(ruby --version | sed -e "s/^ruby \(.\..\..\).*$/\1/")
fi fi
# Disable XON/XOFF flow control (^s/^q).
stty -ixon
# SSH specific config. # SSH specific config.
if [ -n "$SSH_CLIENT" ]; then if [ -n "$SSH_CLIENT" ]; then
# show host only if this is an ssh session # show host only if this is an ssh session
@ -63,13 +60,20 @@ fi
USER_NAME="Holger Just" USER_NAME="Holger Just"
USER_EMAIL="web@meine-er.de" USER_EMAIL="web@meine-er.de"
# Setting up git.
if [[ -n $NOPROMPT ]] && [[ -f ~/.gitconfig ]]; then # Only if we are in an interactive session
if [ "$(git config --global user.name)" != "$USER_NAME" ]; then if [[ $- =~ 'i' ]]; then
echo "WARNING: git's user.name is $(git config --global user.name)" # Disable XON/XOFF flow control (^s/^q).
fi stty -ixon
if [ "$(git config --global user.email)" != "$USER_EMAIL" ]; then
echo "WARNING: git's user.email is $(git config --global user.email)" # Setting up git.
if [[ -f ~/.gitconfig ]]; then
if [ "$(git config --global user.name)" != "$USER_NAME" ]; then
echo "WARNING: git's user.name is $(git config --global user.name)"
fi
if [ "$(git config --global user.email)" != "$USER_EMAIL" ]; then
echo "WARNING: git's user.email is $(git config --global user.email)"
fi
fi fi
fi fi