Often a user will start a long-lived foreground job such as top
,
an editor, an email client, etc, and wishes the name of the job
to be shown in the title. This is a more thorny problem and is
only achieved easily in zsh
.
zsh
provides an ideal builtin function for this purpose:
preexec() a function which is just before a command is executed
$*,$1,... arguments passed to preexec()
Thus, we can insert the job name in the title as follows:
case $TERM in
xterm*)
preexec () {
print -Pn "\e]0;$*\a"
}
;;
esac
Note: the preexec()
function appeared around version 3.1.2
of zsh
, so you may have to upgrade from an earlier version.
This is not easy in other shells which lack an equivalent of the
preexec()
function. If anyone has examples please email
them to the author.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |