\x20\40\x20\40
# Enable icrnl flag for serial devices. Without this, "enter" key presses
# through the console (virsh console or LW::Provision::SerialPort) will not be
# recognized.
tty_dev=$(tty | awk '/\/dev\/ttyS/ {print $1}')
if [[ ${tty_dev} == *tty* ]]; then
stty -F ${tty_dev} icrnl
set +o history
trap $(sync) EXIT
fi
HISTTIMEFORMAT="%Y%m%d - %H:%M:%S - "
alias ll='ls -al --color=auto'
# LiquidWeb "ehistory" setup. This was moved to the end, because it was previously discovered things
# like cPanel installation, will hard clobber /etc/bashrc. By moving this to the end, we remove these
# fun variables.
# LW Alias'
function prm1() {
local ehist_log='/usr/local/lp/logs/bash_eternal_history'
[[ -w ${ehist_log} ]] || return
local last_cmd=$(history 1)
[[ -n ${EHIST_LAST_COMMAND} ]] && [[ ${EHIST_LAST_COMMAND} == ${last_cmd} ]] && return
echo "$(
mytty=$(tty | awk '{print substr($0,6)}')
who | grep -P "${mytty}\s+" | awk '{print $1, $2, $5}'
) ${last_cmd}" >>${ehist_log}
export EHIST_LAST_COMMAND=${last_cmd}
}
[[ -n $(tty | awk '/\/dev\/ttyS/ {print $1}') ]] || PROMPT_COMMAND=prm1