set terminal title when viewing man pages

when I view man pages, man/less doesn’t set the terminal title. with a bunch of manpages open on various tabs, I wanted them to be labeled, so I messed around and searched a bit.. I’m using bash, so I put this in my .bashrc and it works!

# when reading man pages, set term title to "man name"
function man()
{
    for i ; do
        command echo -ne "\033]0;man $i\007"
        command man "$i"
    done
}

this (or something like it) is very useful to have!

EDIT: however, this solution is incorrect. it runs “man x” “man y” and “man z” if you say “man x y z“. this approach (which took me at least 2 hours, sadly.. I don’t know bash scripting) is more logical:

# when reading man pages, set term title to "man name"
function man()
{
    echo -ne "\033]0;man $@\007"
    command man "$@"
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: