
ksh: Set date/time in prompt
I would write a function and place it in my .kshrc file so that all ksh
instances know about the function.
alias -x cd=_cd # always use this CD command
HN=`hostname` # set the system's name
DT=`date '+%m/%d/%y'` # set the date
function _cd {
if [ $# -eq 0 ] ; then # No arguments passed
set -- ~ # set $HOME in $1
fi
'cd' $@ # cd to command line argument
# this uses the built-in cd
PS1="${HN} ${LOGNAME} @ ${PWD}
${DT} : ) "
#-----------------------------------------------#
# set the prompt every time I start a shell #
#-----------------------------------------------#
PS1="${HN} ${LOGNAME} @ ${PWD}
${DT} : ) "
By putting this information in the .kshrc. Every new ksh will have this
prompt. It will be a two line prompt. The first line will have:
SystemName MyUserName @ PresentWorkingDirectory
02/08/98 : )
The second line has the date on it. Simply modify the date command
to change the prompt to include the time.
The alias -x _cd says use the _cd command instead of the shell built-in
and the 'cd' tells the ksh to use the built-in cd command not the
alias that was exported.
Hope this helps!!
--
__o NO FEAR 'rm: text file busy'
_`\<,_ Bobby Higgins email: bhigg...@swbell.net
(_)/ (_)
************ peddlin' as fast as I can