Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Walkthrough code comments

  • Loading branch information...
commit dc7fb5ef93071265dabdb45e5b2fea57e3e8c469 1 parent 4f282ac
@gioele authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 bashrc_dispatch
View
9 bashrc_dispatch
@@ -20,10 +20,13 @@ EXPORT_FUNCTIONS=true
# ----
# Avoid recursive invocation
+
[ -n "$BASHRC_DISPATCH_PID" ] && [ $$ -eq "$BASHRC_DISPATCH_PID" ] && exit
BASHRC_DISPATCH_PID=$$
+# Setup the main shell variables and functions
+
SHELL_PLATFORM='OTHER'
case "$OSTYPE" in
*'linux'* ) SHELL_PLATFORM='LINUX' ;;
@@ -39,9 +42,14 @@ if ! type -p shell_is_login ; then
shell_is_script () { ! shell_is_interactive ; }
fi
+
+# Make $BASH_ENV the same in interactive and non-interactive scripts
+
[ -z "$BASH_ENV" ] && export BASH_ENV="$BASH_SOURCE"
+
# Now dispatch special files
+
[ -f "${HOME}/.bashrc_all" ] && . "${HOME}/.bashrc_all"
[ -f "${HOME}/.bashrc_script" ] && shell_is_script && . "${HOME}/.bashrc_script"
[ -f "${HOME}/.bashrc_interactive" ] && shell_is_interactive && . "${HOME}/.bashrc_interactive"
@@ -63,6 +71,7 @@ $fn_cmd -f shell_is_login
$fn_cmd -f shell_is_interactive
$fn_cmd -f shell_is_script
+
# Unset local variables
unset fn_cmd
Please sign in to comment.
Something went wrong with that request. Please try again.