On Mon, 2008-02-11 at 11:46:49 -0000, Adam D. Barratt wrote: > Guillem Jover wrote: > [...] >> In the original mail I referred to redirecting to the same file, and >> not file descriptor. Anyway the problem comes with something like: >> >> echo foo >&/dev/null >> echo foo &>/dev/null >> >> Those will fail in dash (for example), and as can bee seen from SUSv3 >> the only supported tokens after [n]>& are digits or '-'. Anything else >> gets an unspecified behaviour. I guess the biggest problem is that >> word can be anything which at the end expands to those valid tokens. > > Yeah, you're right; I should have read the relevant section of SUS more > closely.
No problem! > I've now implemented a check for >& or <& followed by anything other than > - or a string of digits. I've left the check for bare &> in place, as > that's a bashism regardless of the surrounding context. For the case of expansion, I suppose it should be enough to ignore the cases there's a variable, like in: $ a=2 $ echo foo >&$a as to handle that properly, would imply parsing most of the shell script. regards, guillem -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]