perforce_bashrc #7

  • //
  • guest/
  • perforce_software/
  • helix-installer/
  • dev/
  • src/
  • perforce_bashrc
  • View
  • Commits
  • Open Download .zip Download (1 KB)
export PS1='$USER@${HOSTNAME%%.*}:$PWD '

alias md='mkdir -p'
alias rd=rmdir
alias cls=clear
alias o='p4 opened ...'

# Add 'p4h' help alias to pipe pages of help docs to 'less', a popular pager.
# Sample Usage:  p4h dvcs
function p4h () { p4 help "$*" | less; }

[[ -r /p4/common/bin/p4_vars ]] && source /p4/common/bin/p4_vars EDITME_SDP_INSTANCE

#------------------------------------------------------------------------------
# Independent per-terminal session command history.  Over time, this will
# create a number of history files that can be cleaned with a command like
# this sample, which removes all shell history files over a year old.
# $ find ~/.hist -type f -mtime +365 -exec rm -f {} \;
#------------------------------------------------------------------------------
export HISTFILESIZE=5000
export HISTTIMEFORMAT="%Y/%m/%d %Z %H:%M:%S "

# Set per-shell history files stored in ~/.hist unless HISTFILE is readonly.
if [[ -z "$(readonly | grep HISTFILE 2>/dev/null)" ]]; then
   [[ ! -d ~/.hist ]] && mkdir ~/.hist
   export HISTFILE=~/.hist/history.$$.$RANDOM
fi
# Change User Description Committed
#7 30484 C. Thomas Tyler Changed so HISTFILE is per-shell only if HISTFILE isn't readonly in
bash environment.
#6 28927 C. Thomas Tyler After further testing, it turns out the fix in @28924 does not work.

This improves on that change by removing the quotes entirely rather
than moving the '~' character outside the quotes.  This actually
does work reliably across Linux variants, and still avoids using the
HOME variable which. HOME isn't 100% guaranteed to be set, while the
~ (tilde) always works in bash, by definition (when not interfered
with by quotes).

#review-28925 @d_benedict
#5 28924 C. Thomas Tyler Fixed issue with HISTFILE on Ubuntu.

#review-28925 @d_benedict
#4 27184 C. Thomas Tyler Added best practice of using per-terminal window shell history files.
#3 25492 C. Thomas Tyler Fixed issues with parameterization of the instance.
#2 25268 C. Thomas Tyler Added handy 'p4h' "p4 help" alias to default ~perforce/.bashrc file.
#1 25227 C. Thomas Tyler Added templates for ~perforce files .bash_profile and .bashrc.