[TUHS] sockets (was Re: First appearance of named pipes)

Tony Finch dot at dotat.at
Thu Mar 26 11:20:35 AEST 2020


So I fooled around making an HTTP request from bash...

	(printf 'HEAD / HTTP/1.0\r\nHost: dotat.at\r\n\r\n'; cat 1>&2) \
		0<>/dev/tcp/dotat.at/http 1>&0

And I wondered if it would work with ksh too. It does, but there is weirdness.

Bash's <> operator follows POSIX, so in my one-liner the 0 is redundant.

https://pubs.opengroup.org/onlinepubs/007908799/xcu/chap2.html#tag_001_007_007

However when I look at a ksh man page I find it says

https://github.com/att/ast/blob/master/src/cmd/ksh93/sh.1#L3458

    <>word    Open file word for reading and writing as standard output.

I thought POSIX got features like this from ksh so I'm curious that a
weird little incompatibilty like this has crept in.

(The copy of ksh.1 I have from the CSRG archives lacks <> so I guess that
version was ksh88?)

Tony.
-- 
f.anthony.n.finch  <dot at dotat.at>  http://dotat.at/
Sole: Northerly 6 or 7 at first in west, otherwise easterly or northeasterly 5
or 6. Moderate or rough, occasionally very rough in west. Showers in west.
Good.


More information about the TUHS mailing list