Search this site


Metadata

Articles

Projects

Presentations

Slight update.. ksh prompt

Found a few issues with the latest changes I made to my ksh prompt...

[ -w "/" ] && Z="#" || Z=">"; export Z
PROMPT='$(A=$?; /bin/echo -n $HOST"("`/bin/pwd | /usr/bin/sed -Ee "s,(/usr)?$HOME,~,"`") [!] "$([ $A -ne 0 ] && /bin/echo -n "!!${A}!! ")$Z" " )'
XTERM=
case $TERM in
  aterm|xterm|dtterm)
    XTERM='$(echo -n "\033]2;'${PROMPT%%$Z*}')\007" 1>&2)'
    ;;
esac 
export PS1=$XTERM$PROMPT

Keep in mind that PROMPT is very long...
Previously, it didn't report exit codes due to kludges that made $? change to 0 due to the exit status of some of the crap that runs inside the prompt.

Huzzah. However, on a sad note I'll point out the obnoxious length of PS1 now...

nightfall(~) [569] > echo "${#PS1}"
257