I've got a simple command that sets the term title:
# Allow the user to set the title.
function title {
PROMPT_COMMAND="echo -ne \"\033]0;$1 ($PWD)\007\""
}
export -f title
I'd like to access this from a script:
16:28 $ cat ./scripts/webserver.sh
#!/bin/bash
title 'webserver'
nodemon ./app/webserver.coffee
I've placed title
in .bashrc
, .bash_profile
and .profile
and sourced every one of those files after. I can run the title
function fine from the command line. Regardless of what I do, the title function doesn't run when I run my script file. There's no error, just no change to the title. What am I doing wrong?
A bit more info: I added an echo 'changing title'
line in the title function. The echo is being output but the title isn't being changed. So there must be a problem with the title function?
Related: How to change Gnome-Terminal title?