ash: substring processing seems to be borken

James Simmons jsimmons at infradead.org
Tue Apr 15 19:36:30 UTC 2008


> On Tue, 15 Apr 2008, James Simmons wrote:
> 
> > This fails.
> >
> > runlevel=$(cat /proc/1/cmdline 2> /dev/null)
> > echo $runlevel					# init [2]
> > runlevel=${runlevel#* [}
> >
> > echo "runlevel '$runlevel'"			# Should be runlevel '2]'
> > 						# we get runlevel 'init [2]'
> 
> Hmm...
> 
> But:
> 
>   # runlevel=${runlevel#* \[}
>   # echo $runlevel
>   2]

Yes you are right, it does work. I also tested dash which also barfed. 
Only bash works without the \. Denys you can remove that work around. 



More information about the busybox mailing list