message: Early-out from setup_extraterm_bash.sh - check for the shell functions
diff: # This file should be sourced from your .bashrc file.
  #
  -# Copyright 2014-2016 Simon Edwards <simon@simonzone.com>
  +# Copyright 2014-2018 Simon Edwards <simon@simonzone.com>
  #
  # This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
  #
  -if [ -z "`alias | grep from`" ]; then
  -if [ -n "$LC_EXTRATERM_COOKIE" ]; then
  +# Early-out in case this has been sourced and enabled already
  +# https://github.com/sedwards2009/extraterm/pull/148
  +
  +isfunction () {
  + type $1 2> /dev/null | head -n1 | grep "$1 is a function" > /dev/null
  +}
  +
  +if ( isfunction "postexec" ); then return 0; fi
  +if ( isfunction "preexec" ); then return 0; fi
  +if ( isfunction "preexec_invoke_exec" ); then return 0; fi
  +
  +# Early-out if LC_EXTRATERM_COOKIE is not set
  +if [ -z "$LC_EXTRATERM_COOKIE" ]; then return 0; fi
  +
  echo "Setting up Extraterm support."
  # Put our enhanced commands at the start of the PATH.
  @@ -48,5 +60,3 @@ if [ -n "$LC_EXTRATERM_COOKIE" ]; then
  alias from="exfrom.py"
  alias show="exshow.py"
  fi
  -fi
  -fi
  \ No newline at end of file
  