# Beyond Hosting .bashrc # Source global bashrc [[ -f /etc/bashrc ]] && . /etc/bashrc #Alias alias vi=vim alias yum-fast='yum --debuglevel=3 --disableplugin=\* --rpmverbosity=warn' #### Functions: PS1 ==start #### # Create ps1 prompt and do every-5-min timestamp _prompt_generate() { export PROMPT_DIRTRIM="2" # Get the current directory, swap out the home directory with a tilde export PWD_FMT=${PWD/${HOME}/\~} # Here we modify the pwd string to shorten the display # Find how many folders deep we are export PWD_FMT_DEPTH="$(echo ${PWD_FMT} | awk -F '/' '{print NF-1}')" # If we're LESS than 3 folders deep, pwd for titlebar and prompt is normal # If we're MORE than 3 folders deep, show ../previous_dir/current_dir export PWD_CUSTOM=$(printf "${PWD_FMT}" | rev | awk -F '/' '{printf $1"/"$2"/.."}' | rev) [[ "${PWD_FMT_DEPTH}" -lt "3" ]] && export PWD_FINAL="${PWD_FMT}" || export PWD_FINAL="${PWD_CUSTOM}" # Add '[SSH]' to titlebar if in SSH session [[ "${SSH_CONNECTION}" ]] && local TITLEBAR_SSH="[SSH] " # Only apply custom titlebar if we're in xterm and on Bash 3+ [[ "${TERM}" == *"xterm"* && "${BASH_VERSINFO[0]}" -ge "3" ]] && echo -en "\033]0;${TITLEBAR_SSH}${HOST_SUB}\007" # Generate / export PS1 prompt with color specfied by C_ENV # It would also be neat to do a color-responsive system load monitor... but not today export PS1="\[${C_ENV}\][\u]\[\e[0m\] ${HOST_SUB}:\[\e[34m\]${PWD_FINAL} \[${C_ENV}\]\\$\[\e[0m\] " } #### Functions: PS1/bashrc ==final #### # vim: set syntax=sh filetype=sh ts=2 sw=2 tw=0 noet :