SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2015-07-07 21:12:20

hudson
Member
Registered: 2015-06-28
Posts: 16

Changing terminal titles for man, less and vi

#!/bin/bash
# Sets terminal title for programs which use an alternate screen buffer
# such as man, vi and less. See XTERM(1)
# With other commands, title with be overwritten unless PS1 is changed in
# $HOME/.bashrc

BIN=$1
shift

OPTS=''
while [ $# -gt 1 ] ; do
    OPTS=$OPTS" $1"
    shift
done

TARGET=$1

case "$BIN" in
man )
    PROGRAM="Manual Page"
    ;;
vi )
    PROGRAM="Editing in Vi"
    ;;
less )
    PROGRAM="Viewing with Less"
    ;;
* )
    PROGRAM=${BIN}
    ;;
esac

echo -en "\033]0;${TARGET} - ${PROGRAM}\a"

$BIN $OPTS $TARGET

Last edited by hudson (2015-07-17 19:04:12)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo