Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to setup busybox's ash on an embedded system to support expanding the PS1 prompt statement. I have it currently set as

PS1='\u@\h:\w\$ '

However, all that is displayed is literally \u@\h:\w\$. My environment vars are

  • HOSTNAME=linux
  • USER=root
  • and my pwd is /

So what should be displayed is root@linux:/$. Is there something special I need to do to get the PS1 to expand correctly?


One thing I noticed is my SHELL variable is /bin/sh even though in my /etc/inittab I have the following line

ttyO0::respawn:-/bin/bash

I imagine this is the case because sh and bash are both aliased to ash in the busybox config. However, I have the following options enabled though:

  • bash-compatible extensions
  • Expand prompt string
share|improve this question
1  
Did you turn on FEATURE_EDITING (“Command line editing”)? It might help if you posted your Busybox .config. –  Gilles Nov 14 '12 at 23:25
    
That fixed the problem. For some reason, finding that was harder than expected. I don't know how long I spent looking in the menuconfig and on Google for a solution to this. Thanks! –  E-rich Nov 16 '12 at 11:38
add comment

1 Answer

up vote 2 down vote accepted

Prompt expansion is always enabled in Busybox's ash or hush if it's been compiled in, there is no runtime way of turning it off. Check that it is really compiled in. In particular, in ash, this requires FEATURE_EDITING (“Command line editing”) to be enabled as well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.