Modify the cdh function to set the prompt (PS1) to show the current directory; for example:

/users/pat: cdh /tmp
/tmp: cdh
/users/pat:


This is done by modifying both the -n and default "*" case statement values. In fact, it is an addition of exactly two lines. Here's the segment that shows them (they are both in bold to make it clear what's been added):
-[0-9]|-[0-9][0-9]) # cd to dir in list
i=${1#-} # remove leading '-'
'cd' ${CDHIST[i]}
PS1="$PWD : " ;;
*) # cd to new dir
'cd' $@
PS1="$PWD : " ;;
esac

Computer Science & Information Technology

You might also like to view...

Does a VM require fewer resources than a physical machine?

What will be an ideal response?

Computer Science & Information Technology

Webpage documents that use an HTML extension can be imported._________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The compiler only generates an error message for undeclared variables if they are not used in the program.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The two major classifications of fiber optic cable are

A) Single and multimode B) Plastic and glass C) Flexible and inflexible D) Colored and monochrome

Computer Science & Information Technology