@@ 48,7 48,14 @@ else
# mksh: no DEBUG trap / PROMPT_COMMAND. Log from PS1 each prompt.
# The leading $(...) captures $? first, so the exit code is accurate,
# and _kh_prompt emits nothing so the visible prompt is unchanged.
+ # Skip the first render: at shell start fc -ln -1 is a stale HISTFILE
+ # entry, not a command run this session.
+ _kh_first_prompt=1
_kh_prompt() {
+ if [ -n "$_kh_first_prompt" ]; then
+ unset _kh_first_prompt
+ return
+ fi
_kh_log "$(fc -ln -1 2>/dev/null | sed 's/^[[:space:]]*//')" "$1"
}
PS1='$(_kh_prompt "$?")'"$PS1"