Please take a look at my code for a customized PS prompt below.
I'd like to figure out how to eliminate #2 and only display $pwd
when only whitespace is entered as a command.
And also, this is my first "real" PS code, so comments regarding
technique or even style would be appreciated.
All lines below indented two spaces so wrap can be detected:
Function prompt {
# PS prompt displays $pwd only when either of any of these is true
# #1 current command is just whitespace
# #2 last command is exactly the same as current command
# #3 no commands have yet been entered
# When $pwd is displayed, it displays on a line above the effective PS prompt
#
$h = h
$p = ""
if ($h -eq $null)
{$p = 'PS ' + "$pwd" + "`n"}
else
{
if ( $h[$h.length-1].CommandLine -eq $global

rompt_last_command )
{$p = 'PS ' + "$pwd" + "`n"}
}
$p + 'PS> '
if ($h -eq $null)
{$global

rompt_last_command = ""}
else
{$global

rompt_last_command = $h[$h.length-1].CommandLine}
}
- Larry