I'd like to have the current jobs status displayed in the title of my terminal. In Bash, I can use PROMPT_COMMAND for that. Korn Shell (ksh93) doesn't have that.Other answers suggest using command substitution inside $PS1, which works fine in the general case, but not for the jobs command. The problem here is that jobs is concerned about the jobs of the current shell, but command substitution (i.e. PS1='...$(jobs)...') is performed in a subshell, so there are no jobs.The only mechanism I'm aware of is trap '... jobs ...' DEBUG, but that would execute way too often. Do you know a way how to run commands in the context of the current shell, once on each prompt, or is this not possible in Korn shell?!
Execute command within current shell before every prompt
ksh;prompt
By default if you just set PS1=.... then the stuff inside the quotes is evaluated at the time you set it.However if you enclose it inside ' instead then it's evaluated at display time.  And it doesn't cause a subshell for $(jobs).e.g.$ PS1='> $(jobs)> $ '$ sleep 1000 &[1] 7541[1] +  Running                 sleep 1000 &$ sleep 1000 &[2] 7543[2] +  Running                 sleep 1000 &[1] -  Running                 sleep 1000 &$ kill %1[1] - Terminated               sleep 1000 &[2] +  Running                 sleep 1000 &$ kill %2[2] + Terminated               sleep 1000 &$ (This test done on Debian Jessie with ksh93 but should work on all ksh93 variants; I don't have any ksh88 to test with.)