[net.bizarre] fun, alternating prompt

uggworek@sunybcs.UUCP (Don Gworek) (07/16/85)

Here is an addition to your .cshrc, which sets your prompt to alternate
between two cartoon characters, with every change of directory.

The prompt forms are:

oo                  oo
 \                   \
\/                  \/
34 directory1 %     2:45 directory1 %
						AND
\\\\                \\\\
[ O-O               [ O-O
 \ ~/                \ ~/
35 directory2 %     2:46 directory2 %

Note that the shell number appears starting with the second shell,
and that "happy" and "bazooka joe" switched with a cd (or pushd or popd).
      
============================ CUT HERE ================================

# if a prompt is defined, .cshrc is being sourced as part of a command.
# The code AFTER the first "if" is executed ONLY when a new user shell is made.

if (! $?prompt) exit

#
# other .cshrc aliases
#   ...

#
#  set the shell depth.  Having the first shell number linger around
#  in your prompt can be obnoxious, so "depths" is "empty" for the first
#  shell.  Starting with shell 2, depths is "N:".
#
if ($?DEPTH) then
	@ depth = $DEPTH + 1
	setenv DEPTH $depth
	set depths=${DEPTH}:		# note the ":" colon separator here
else
	setenv DEPTH 1 
	@ depth = 1
	set depths
endif

#
# Have the prompt alternate between two fun prompts.  Every change of
# directory brings     oo        \\\\
#                       \        [ O-O
#                      \/         \ ~/
#                            or
set sp_count=0;
alias sp '@ sp_count=$sp_count + 1;\\
  if !($sp_count & 1) set prompt="oo\\
 \\\
\/\\
${depths}! $cwd:t % ";\\
  if ($sp_count & 1) set prompt="\\\\\\
[ O-O \\
 \ ~/\\
${depths}! $cwd:t % "'

sp
alias cd 'cd \!*;sp'
alias pushd 'pushd \!*;sp'
alias popd 'popd \!*;sp'