[BusyBox] Hexadecimal escapes in ash

Charles Steinkuehler charles at steinkuehler.net
Wed Apr 7 17:52:59 UTC 2004


Geoffrey Wossum wrote:
> Hi all,
> 
> I'm using ash in busybox-1.00-pre8.
> 
> I have a bash shell script I'm trying to get working on it, which has the 
> following construct to assign the ASCII character 0xfe to sep:
> 
> sep=$'\xFE'
> 
> This doesn't work in ash.  Instead, sep gets set to "$\xFE", minus the double 
> quotes.  Is this a bug in ash, or is there another way I should be setting 
> the ASCII character in sep?

AFAIK, ash doesn't do this sort of expansion.  You'll have to generate 
special characters some other way...probably the easiest is to use echo:

spe=`echo -ne '\376'`

NOTE:  I don't think the ash echo supports hex escapes (at least mine 
doesn't...don't know about the latest busybox ash), so I used octal in 
the above example.

-- 
Charles Steinkuehler
charles at steinkuehler.net



More information about the busybox mailing list