[X-Unix] .bash_profile

William H. Magill magill at mcgillsociety.org
Fri Jan 9 19:59:45 PST 2004


On 09 Jan, 2004, at 04:50, Simon Forster wrote:
> Just out of curiosity, what sort of changes are people making to their 
> shell environment by changing .bash_profile? Really I'm just after 
> hints and tips which could make my command line experience easier.

Personally, I use a ".profile" which is invoked across sh/ksh/bash, and 
across multiple OS types ... but then I'm a multi-platform Unix type...

What do I set? Depending on the platform I'm using (which is determined 
in .profile)

PATH
LD_LIBRARY_PATH
MANPATH

I set umask to be 077 (but then I'm a paranoid security type).

I set different prompts depending on if I'm sudo'd to root or not... 
and I use a long, two line prompt which displays the directory I'm in, 
the userid and the hostname. (Again, I run multiple systems and it is 
useful to know which window is where... with either X11 or simple ssh.)

EDITOR=/usr/bin/emacs
VISUAL=/usr/bin/emacs


# ------------------------------------- if less exists make it the pager
if [[ -f /usr/local/bin/less || -f /usr/bin/less ]]; then
         PAGER=less
#   -e Exit less at second eof... [--quit-at-eof]
#   -X Disables termcap initialization and deinitialization strings
#      eliminates clearing the screen at EOF...[--no-init]
         LESS="-e -X"
         export PAGER LESS
fi
# -------------------------------------

size and location of the history file (HISTSIZE SAVEHIST HISTFILE)

BLOCKSIZE and CLICOLOR for "ls"

I use two aliases all the time:

alias ls="ls -als"
alias rm="rm -i"

This gives me the long form of ls by default and always asks me if I 
want to delete files.
(You can always bypass the expansions by "\ls" if you need some other 
format.)

and for a paging form of ls as found in tcsh:

# ------------------------------------- for the ls comand:
#     to get bash to do what tcsh does -- with:
#            alias ll        'ls -lag \!* | more'
#     this function, works with ksh, bash, zsh:
ll()
{
         /bin/ls -alsv $* | less
}

Under different situations I also use and therefore set
ENV=.envfile_<hostname>

And put stuff specific to particular application environments in there.

T.T.F.N.
William H. Magill
# Beige G3 - Rev A motherboard - 768 Meg
# Flat-panel iMac (2.1) 800MHz - Super Drive - 768 Meg
# PWS433a [Alpha 21164 Rev 7.2 (EV56)- 64 Meg]- Tru64 5.1a
# XP1000 - [Alpha EV6]
magill at mcgillsociety.org
magill at acm.org
magill at mac.com



More information about the X-Unix mailing list