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 :)

About Chris

Twenty-something year old computer science graduate living in the West Midlands, working as a PHP software developer for a local company.
This entry was posted in Linux, Network, benjamin. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>