Ash and PROMPT_COMMAND

The ash shell doesn’t appear to support setting the PROMPT_COMMAND variable which sets the window title in xterm and companions. I found a workaround to this, by including it in the PS1 variable.

I put this in my /etc/profile:

export PS1='\[\e]0;\h:\w\a\]\[\e[0;32m\]\h\[\e[0m\]:\w\$'

The \[\e]0;\h:\w\a\] is for the windows title. Essentially, \h hostname and \w current directory are bound by esc (\e) zero and bell (\a).

The second part \[\e[0;32m\]\h\[\e[0m\]:\w\$ is for the prompt, which is the same as above but the prompt is colored green.

supernaut at OpenWRT Forums
<http://forum.openwrt.org/viewtopic.php?pid=18521>

It worked perfectly :)

Leave a Reply


Content Copyright © 2005-2008 Chris Smith. All Rights Reserved.