2

Lets say, the prompt is as below

run_scripts >

How to set that terminal tab title same as prompt i.e Terminal tab tile also should be
run_scripts>

So that terminal title should dynamically update when the prompt changes.

user1228191
  • 681
  • 3
  • 10
  • 19
  • 1
    This will be a matter of setting a prompt that contains special terminal sequences to update the terminal title bar. You've tagged the question [tag:tclsh]. Please clarify that you are looking for this functionality only in `tclsh`, as opposed to in a system shell like `bash` or `zsh`. Each piece of software that features a prompt will have its own way of setting it... – Celada May 15 '13 at 17:28
  • yes, I'm currently using tclsh!! Can you please that setting we need to do!! – user1228191 May 16 '13 at 08:51
  • I don't know TCL, so I can't answer, but according to its manpage you need to set `tcl_prompt1` to a script that ouputs the prompt. In this script, you need to call external commands `tput tsl` before outputting the window title and `tput fsl` afterwards. – Celada May 16 '13 at 14:02

3 Answers3

2

Many terminals emulators are able to understand the special escaping : "\033]0;foo\007".

Jean-Baptiste Yunès
  • 34,548
  • 4
  • 48
  • 69
1

I know its a old post but i saw it today : Here is the answer:

title `pwd`

if title command does not works in your shell then:

  1. write a shell script with follwing contents (filename = title)
#!/usr/bin/tcsh -f
echo "^[]2;$1^G^[]1;$1^G"
  1. then:
chmod +x title (give this script executable permission)
  1. type:
title `pwd` <enter>
jww
  • 97,681
  • 90
  • 411
  • 885
0

This single line command will change the title of the tab.

  1. Simply run the command from terminal tab which title need to change-
    PS1=$PS1"\[\e]0;My_Tab_Name\a\]"

Some Info: The PS1 is a primary prompt variable which holds the characters displayed at the terminal prompt. You can set it whatever you want. However the above command will make it only work for current terminal session. Once you close the terminal and opena new one, it'll be the default one.

To make it permenant edit the PS1 variable in ~/.bashrc or ~/.zshrc file.

Benefits-
It help us to easily navigate over the tabs.

Wilfred Almeida
  • 601
  • 8
  • 15
S.Yadav
  • 4,273
  • 3
  • 37
  • 44