Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only execute .bashrc if not a login shell

Also, set a version in the builtin naverc, so that we can
safely make changes to it, and be sure that they'll be
overwritten when nave is updated.
  • Loading branch information...
commit 81b3b043842e9fd935153b7ca971bf67f3c72945 1 parent 233574d
@isaacs authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 nave.sh
View
12 nave.sh
@@ -61,22 +61,28 @@ main () {
fi
# set up the naverc init file.
- if ! [ -f "$NAVE_DIR/naverc" ]; then
+ # Important! Update this number any time the init content is changed.
+ local rcversion="#2"
+ if ! [ -f "$NAVE_DIR/naverc" ] \
+ || [ "$(head -n1 "$NAVE_DIR/naverc")" != "$rcversion" ]; then
cat > "$NAVE_DIR/naverc" <<RC
+$rcversion
[ "\$NAVE_DEBUG" != "" ] && set -x || true
if [ "\$NAVE_LOGIN" != "" ]; then
[ -f ~/.bash_profile ] && . ~/.bash_profile || true
[ -f ~/.bash_login ] && . ~/.bash_login || true
[ -f ~/.profile ] && . ~/.profile || true
+else
+ [ -f ~/.bashrc ] && . ~/.bashrc || true
fi
-[ -f ~/.bashrc ] && . ~/.bashrc || true
export PATH=\$NAVEPATH:\$PATH
[ -f ~/.naverc ] && . ~/.naverc || true
RC
fi
# couldn't write file
- if ! [ -f "$NAVE_DIR/naverc" ]; then
+ if ! [ -f "$NAVE_DIR/naverc" ] \
+ || [ "$(head -n1 "$NAVE_DIR/naverc")" != "$rcversion" ]; then
fail "Nave dir $NAVE_DIR is not writable."
fi
Please sign in to comment.
Something went wrong with that request. Please try again.