Technical article 127398

Is there an example bashrc available?

OpenServer 6.0.0OpenServer 5.0.7UnixWare 7.1.4

Written · Last revised

Problem

I would like an example bash shell which, for example, contains some aliases and tells me my current directory.

Solution

Here is an example of a $HOME/.bashrc file which achieves this.

It can be modified to suit your particular needs but serves as a good example:

          ----- cut here -----
set -p
if test "$UID" = 0 ; then
    PS1="\h:\w # "
else
    PS1="\u@\h:\w> "
fi
umask 0022
#	# Returns short path (last two directoeries)
spwd () {
  ( IFS=/
    set $PWD
    if test $# -le 3 ; then
	echo "$PWD"
    else
	eval echo \"..\${$(($# - 1))}/\${$#}\"
    fi ) ;
   }
alias lfs='lf -s'     # list files with size/type
alias ll='ls -l'      # long listing of files (follow symlinks)
alias la='lf -a'      # list all files with type
alias lfsa='lf -sa'   # list all files with size/type
alias lsd='lf -d *(-/DN)'     # list only directories
alias c='clear'               # handy shortcut
alias d='date'                # handy shortcut
----- to here -----

From the Xinuos technical article database, record 127398. Reproduced with permission. The original is at www.sco.com/ta/127398, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.