Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • "no reason is given for it". This is what I want to know. :-) Commented Oct 29, 2015 at 18:58
  • 2
    Indeed. Because [n]>&word is the syntax for fd duplication when word is a number or - and so using >&word where word is a file is a confusing syntactic collision. I think the better question is why is this even allowed. Commented Oct 29, 2015 at 19:08
  • 2
    Additionally the only reason the the >&file syntax even works is even legal, as far as I can see, is because the spec says "If word evaluates to something else, the behavior is unspecified." Commented Oct 29, 2015 at 19:09
  • 1
    I'm still learning a lot of these strange things, but it seems like one could write a book on "Why is this even allowed in Bash."
    – miken32
    Commented Oct 29, 2015 at 19:10
  • Totally makes sense but I couldn't figure it. That explanation is missing from bash 3.2.25(1)-release (x86_64-redhat-linux-gnu). Commented Oct 29, 2015 at 19:10