[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: <> redirection and notations



I don't feel good mentioning this now, but ...

Symbol		Mode		Truncate	Create
<		r		n		n
>		w		y		y
>>		a		n		y
<>		r+		n		y
<>>		a+		n		y

In the "mixed" redirection operators ("<>" and "<>>") we take the
truncation characteristics from "<" and the creation characteristic
from ">" or ">>".

Would "<&", ">&", and ">>&" not be better, as the "&" can be read as
extending the r/w mode (like to "+" in "[rwa]+") without affecting the
truncation or creation characteristics of the operation.  We then get
"open for r/w with truncation" for free  (">&"), along with the current
"<>" ("<&") and "<>>" (">>&").  All of these are currently syntax
errors in es, so we don't need to worry about compatibility.

A modifier character is perhaps more elegant than another two
redirection operators.  All of this does kind of look like sh dup-ing,
but inter-language compatibility is for weenies.  You've already
thrown out 2>&1 in favour of >[2=1].

And, hey, when are we going to get to write on "<<" and "<<<"?