ash >& bug? [was: Re: svn commit: trunk/uClibc/test]

Denys Vlasenko vda.linux at googlemail.com
Sun Oct 5 18:39:11 UTC 2008


On Thursday 02 October 2008 04:25:45 pm Bernhard Reutner-Fischer wrote:
> This one works reliably about everywhere:
> $ (echo "out1" ; echo "err" >&2 ; echo "out2") > foo 2>&1
> 
> but ash rejects this:
> $ (echo "out1" ; echo "err" >&2 ; echo "out2") 2>&1 >& foo
> ash: syntax error: Bad fd number
> 
> It tries to use 'foo' as fd, which is not really appropriate as i think
> a '>&' implies stdout, does it?

No, it does not:

[root at localhost tmp]# bash
[root at localhost tmp]# echo HI >&
bash: syntax error near unexpected token `newline'
[root at localhost tmp]#

Looks like in ">&file" "file" is mandatory.

The attached patch implements it for ash. Please test.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3.patch
Type: text/x-diff
Size: 8427 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20081005/ff6d5927/attachment.bin 


More information about the busybox mailing list