I want to be able to name a terminal tab so I can keep track of which one is which. I found this function (here) and put it in my .bashrc
:
function set-title() {
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$*\a\]"
PS1=${ORIG}${TITLE}
}
and now when I call set-title my new tab name
the tab name is changed as expected to "my new tab name". The problem is that I want to open a new tab and name it using set-title
. The way I have tried to do this, is like this:
gnome-terminal --geometry=261x25-0+0 --tab -e "bash -c 'set-title tab1; sleep 10'" --tab -e "bash -c 'set-title tab2; sleep 10"
However, now I get the following error message:
bash: set-title: command not found
And I think this is to do with the new gnome tab not knowing about the .bashrc
function yet.
How can I get this to work?
$PS1
hack? Justecho
the magic string that sets the title. – Celada Nov 03 '16 at 08:32PS1=
withecho
? – Haych Nov 03 '16 at 10:03