#!/bin/bash

#       When bash is invoked as an interactive login shell, or as a  non-interac-
#       tive  shell with the --login option, it first reads and executes commands
#       from the file /etc/profile, if that  file  exists.   After  reading  that
#       file,  it  looks  for  ~/.bash_profile, ~/.bash_login, and ~/.profile, in
#       that order, and reads and executes  commands  from  the  first  one  that
#       exists  and  is  readable.  

if [ -f /etc/profile ];
then
   source /etc/profile
fi

if [ -f ~/.bash_profile ];
then
   source ~/.bash_profile
else
   if [ -f ~/.bash_login ]
   then
      source ~/.bash_login
   else
      if [ -f ~/.profile ]
      then
         source ~/.profile
      fi
   fi
fi

function generate_command_executed_sequence() {
   printf '\e\7'
}

export -f generate_command_executed_sequence


#generate escape sequence after command is executed to notify jediterm emulator
trap "generate_command_executed_sequence" DEBUG
