Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all, I use the following command in a script to set the title of PuTTY Code: export PROMPT_COMMAND='echo -ne "3]0;mytitle"; echo -ne "

Thread: setting PuTTY title in shell script

7"' when i execute the script like ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2011
    Posts
    9

    setting PuTTY title in shell script


    Hi all,

    I use the following command in a script to set the title of PuTTY
    Code:
    export PROMPT_COMMAND='echo -ne "\033]0;mytitle"; echo -ne "\007"'
    when i execute the script like this,
    Code:
    . ./set_title.sh
    mytitle is set as the title of PuTTY.

    Now I'm writing a script to start one process say CRM.

    Code:
    export PROMPT_COMMAND='echo -ne "\033]0;crm"; echo -ne "\007"
    ./crm 13 1
    In this case the title gets sets only when i stop the process using Ctrl+C

    Is there anyway I can set the title and then start the process because my aim is to dedicate one PuTTY window for one process till i stop the process.

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    638
    Quote Originally Posted by zubit View Post
    Hi all,

    I use the following command in a script to set the title of PuTTY
    Code:
    export PROMPT_COMMAND='echo -ne "\033]0;mytitle"; echo -ne "\007"'
    when i execute the script like this,
    Code:
    . ./set_title.sh
    mytitle is set as the title of PuTTY.

    Now I'm writing a script to start one process say CRM.

    Code:
    export PROMPT_COMMAND='echo -ne "\033]0;crm"; echo -ne "\007"
    ./crm 13 1
    In this case the title gets sets only when i stop the process using Ctrl+C

    Is there anyway I can set the title and then start the process because my aim is to dedicate one PuTTY window for one process till i stop the process.
    The problem is "PROMPT_COMMAND" contents is run as a script just before bash writes the prompt. What you want is to put a title for the xterm.

    just simply execute the command:
    Code:
    echo -ne "\033]0;crm\007"
    ./crm 13 1
    Of course you can use PROMPT_COMMAND to put a default title in place via your ~/.bash_profile file:
    Code:
    export PROMPT_COMMAND ='echo -ne "\033]0;My DEFAULT TITLE\007'
    and then run the command via:
    Code:
    echo -ne "\033]0;CRM\007" && ./crm 13 1
    Which would change the title to CRM while "crm" is running and set it back to "My DEFAULT TITLE" when crm is completed.

    (This is assuming that crm does background its self as gvim does.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •