On Thu, Sep 06, 2012 at 08:55:34PM -0700, Mike Frysinger wrote:
> > You left out #3:
> >
> > "I have to support scripts which assume the shell interpreter conforms
> > to the standard and which might be using & adjacent to > without an
> > intervening space."
> 
> which is pretty much #1
> 
> does your code *actually* want to do the equivalent of "& >" ?  that's

The question isn't my code (I'd avoid writing that because of the
prevalence of shells that misinterpret it) but whether arbitrary
third-party POSIX sh code would run.

> extremely unlikely: you're backgrounding everything before that point
> and starting off a new command with a redirect.  yes, that is
> according to the standard correct, but i've never seen anyone do it.

I would guess the most likely place for it to appear would be in
intentionally obfuscated or "compressed" (all unnecessary whitespace
eliminated) scripts.

> i.e. this snippet:
>   some-cmd &>/dev/null ls
> is (according to POSIX) the same as:
>   some-cmd &
>   >/dev/null ls
> or the more common form:
>   some-cmd &
>   ls >/dev/null

">file" is valid by itself as a command; it truncates file to 0 bytes,
creating it if it does not exist. It's even more useful with noclobber
mode, e.g.

set -C;bg_command&>lockfile||exit 1

Rich
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to