Set screen-title from shellscript

You can set the screen / xterm title using the following lines:

#!/bin/bash

mytitle="Some title"
echo -e '\033k'$mytitle'\033\\'

[UPDATE] – by request I’m also including the solution proposed by @Espo below:

Depending on your xterm version or your linux distribution the line above may or may not work and you can try the xterm-defaults:

#!/bin/bash

mytitle="Some title"
echo -e '\033]2;'$mytitle'\007'

For more on the details see: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#s3 or refer to the answer by @Espo below.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)