On 13Feb2013 16:03, Suvayu Ali <fatkasuvayu+linux(a)gmail.com> wrote:
| I know about redirection, but was not aware that I could also open
| sockets! Thanks a lot for the nice explanation, I'll read up more.
Unless bash has even more weirdness in it than I thought, the redirection
is probably relying on a Linuxism to open a port via a Linux specific
/dev entry. Plan 9 pioneered that mechanism. (That said, I know bash
sometimes fakes up /dev/stdin etc for platform lacking them, so maybe it
fakes /dev/tcp as well...)
| I think I'll end up using this solution as it seems the most portable.
To Linux alone, quite possibly.
Just a thought: why not just make your script fail gracefully it it can't
connect? It would avoid all this "probing" that we're all discussing
especially since the probing really amounts to "can I connect?" Your
script will be trying that anyway, so why probe?
Cheers,
--
Cameron Simpson <cs(a)zip.com.au>