Sample Header Ad - 728x90

ksh: how to capture the current invoked command and arguments?

0 votes
1 answer
58 views
How do I obtain a variable with the current command and arguments? I would like to use escape code to print this in an Xterm title bar. I see Terminal.app on MacOS is determining the name of the invoked command somehow. I see the follow implementation for zsh, however I'm looking for ksh. if [ "$SHELL" = '/usr/bin/zsh' ] then case $TERM in rxvt|*term) precmd() { print -Pn "\e]0;%m:%~\a" } preexec () { print -Pn "\e]0;$1\a" } ;; esac fi I'm reading this post on using ksh's DEBUG trap or poster also comments that "running a background task that regularly inspects the output of ps -o stat= -o args= to see which processes run in foreground and what command they are executing" is preferred. Does anyone have more information on this?
Asked by atod (155 rep)
Jan 30, 2025, 08:31 PM
Last activity: Jan 31, 2025, 08:34 AM