[PATCH] ash fancy prompt expansion
Natanael Copa
natanael.copa at gmail.com
Thu Sep 13 04:39:45 PDT 2007
Hi,
Attatched is a patch that fixes the annoying bug in ash prmpt expansion.
Currently the default PS1='\w \$ ' will always show a '$' as prompt
while PS1='\w \\$ ' will show a '#' if effective user is root and '$'
otherwise.
The problem is that the prompt string is expanded as a normal double
quote expansion (readtoken1()) before its sent to the
libbb/lineedit.c:parse_prompt() function. The function readtoken1() will
correctly convert '\$' to '$' before its send to parse_prompt() which is
looking for '\$'.
The attatched patch adds a PSSYNTAX expansion style which is identical
as the DQSYNTAX, except that it keep '\$' as '\$'.
The patch is my contribution to the mess. Please let me know if there
are better ways to handle this.
-nc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-svn-ash-prompt-expansion.patch
Type: text/x-patch
Size: 1506 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20070913/4f3ee09a/attachment.bin
More information about the busybox
mailing list