Skip to content
/ SHELLRC Public

One Unix user's preferred Bourne/Korn shell configuration

Notifications You must be signed in to change notification settings

boyski/SHELLRC

Repository files navigation

This is my shell environment, originally designed to be the default
for a large organization (which for all I know still uses an
earlier fork), but currently maintained largely for my own benefit.
It is known to work with ksh and bash.

To set it up:

1. Instantiate, by copy or clone, this git repo into a publically
accessible place in the same partiaion where home directories go. I
like /home/SHELLRC for public use or $HOME/.SHELLRC for private
use. This directory will become known as $SHELLRC.

2. Cd into $SHELLRC and run "./install". This will set up symlinks
in $HOME pointing into $SHELLRC, preserving and moving aside
any conflicting files in $HOME.

3. Season to taste. You can, of course, replace any symlinks with
copies and modify.

Never set or modify environment variables, particularly PATH, in
the PerShell file(s)!  They should be set in a Profile* file. And
generally you should use the onpath(), offpath(), and pkguse()
shell functions to modify all path variables. Run any of these with
-h to see usage, or grep the files in $SHELLRC for examples.


######################################################################
		     MODIFYING DEFAULTS
######################################################################

-> If you create a file ~/.aliases, it will be read by each new
interactive shell.  This is a good place to put personal aliases etc.

-> By default each shell is given its own history, similar to the
way the csh works. If you want one history file for all your
concurrent shells (which is how ksh and bash work out of the box),
run the command "chmod -w ~/.shellhist" (just once, by hand).

-> The default editor is vi. To change this to emacs or another editor,
add "export VISUAL=emacs" to the beginning of your .profile. Do not
change the value of the EDITOR variable. See below for how to
set/change the default behavior of vi.

-> By default, the current directory (".") is not in PATH. This is
something which I strongly believe to be a feature. If, after careful
consideration, you really want '.' on your PATH, then put the command
"onpath -B ." at the end of ~/.profile.

######################################################################
		     HELP FOR OLD CSH USERS
######################################################################

-> Complete emulations of pushd/popd/dirs are provided.

-> Converting aliases: if you have your own csh aliases, they can be
translated into ksh like this:

   csh: alias foo 'bar'
   ksh: alias foo='bar'

But if your alias takes arguments, you'll need to convert it to a
ksh function instead:

   csh: alias fproc 'ps -ax | grep -v "grep" | fgrep !* | more'
   bash: function fproc { ps -ax | grep -v "grep" | fgrep "$@" | more; }

Note that the !* in the csh alias becomes a "$@" in the bash function.

######################################################################
		     AVAILABLE SHELL FUNCTIONS
######################################################################

Current supplied shell functions include:

   onpath	- this adds entries to path variables, making sure never
		to allow redundant entries.  This has many advantages
		over "export PATH=$PATH:/x/y/z".  Run "onpath -h" for
		full usage. Note that if a path-var is not specified,
		PATH is used by default.

   offpath	- removes specified entries from the specified path
		variable.  See "offpath -h" for usage.

   pkguse	- a wrapper for onpath/offpath.  Example: "pkguse /opt/foo"
		will prepend /opt/foo/bin to PATH and /opt/foo/man
		to MANPATH. See "pkguse -h" for usage.

   xtitlebar	- puts its arguments in the title bar of an X window.
		It's also capable of adding or subtracting substrings
		from the current title. Run xtitlebar -h for usage.

   pushd/popd/dirs - standard semantics

More functions may be added if found generally useful.  Feel free to
contribute functions or ideas.

######################################################################
		            VI SETTINGS
######################################################################

A default group of vi settings is provided along with some useful macros:

The '+' char is bound to a macro which
will reformat the paragraph in
which the cursor sits.  For instance,
hitting '+' in this paragraph
would make it more
readable.

The sequence '*Q' will quote all the text below the current cursor
position by adding a leading "> " as is done in email, and '*U' will
remove such quoting.

The sequence '*n' will set the default shiftwidth to n, where n can have
values [2348].

About

One Unix user's preferred Bourne/Korn shell configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published