For example, to change the Terminal's title to 1337 H4X0R with the script saved as title, you'd type title "1337 H4X0R" at the prompt.
I use it to name alternate shells when I invoke them:
alias bash 'title bash;/usr/local/bin/bash'Read the rest of the article for the script.
alias zsh 'title zsh;/bin/zsh'
The script:
#! /bin/shNOTE: The "osascript" line has been broken onto two rows; enter as one with a space where the line break currently exists! Save the script as a text file and move it to somewhere in your path, ~/bin is a good place. Remember to make the script exectuable (chmod 755 script_name) and then type rehash to start using it right away.
help0()
{
echo "ERROR: No argument provided."
echo "Usage:"
echo " `basename $0` \"title\" to provide a new Terminal title."
}
help2()
{
echo "ERROR: Too many arguments provided."
echo "Usage:"
echo " `basename $0` \"title\" to provide a new Terminal title."
}
if [ $# -eq 0 ]
then
help0;
elif [ $# -eq 1 ]
then
osascript -e "tell application \"Terminal\" to set
custom title of window 1 to \"$1\""
elif [ $# -gt 1 ]
then
help2;
fi

