MinGW+mintty, Bash, minttyのタイトルバーの変更方法。

minttyのタイトルバーの変更方法。

cdで移動するごとにそこのディレクトリ名を表示するようにする。

~/.profileに下記を書き込む。

function settitle ()
{
    t="[$@]"
    # "\e]2;" > control code to start changing the window title
    # "\007"  > control code to end
    echo -ne "\e]2;$t\007"
}

function cd()
{
    builtin cd $@ && settitle `pwd`
}

で、OK! いい感じになった。