[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: /dev/tcp/localhost/finger
From: |
Wilhelm Mueller |
Subject: |
Re: /dev/tcp/localhost/finger |
Date: |
14 May 2001 16:30:49 +0200 |
Adam> However, I can't get it to work with bash.
Adam> (and what would be the syntax for that matter)
Adam> cmd < file.in > file.out
This will open two different sockets, which is not what fingerd
expects. (Actually, inetd will even start two copies of fingerd.)
Adam> echo hi | cat < /dev/tcp/localhost/finger
Adam> does not seem to do trick, like few other commands
Adam> I tried.
Sure, it can't: first, the pipe is assigned to fd0, then this is
replaced by the socket: you still have just one fd open for reading.
Adam> suggestions?
Sure --
( cat 1>&3 2>/dev/null & cat 0<&3 ) 3<>/dev/tcp/localhost/finger
does what you want. The redirection of stderr is becaus fingerd
will shutdown the socket when it has sent its output, so the second
cat gets an EOF on stdin, but the first an IO error on stdout.
But I don't yet know why
{ cat 1>&3 2>/dev/null & cat 0<&3; } 3<>/dev/tcp/localhost/finger
does *not* work...
--
***************************************************
Wilhelm Müller Baumanagement Bremen GmbH
Schlachte 32 Tel: +49-421-361-10629
D-28195 Bremen, Germany Fax: +49-421-361-2295
PGP 2.6.3i: RSA 2048 bits id C2F0A2D1
Fingerprint: B1452644 DEBB647F 94AA3DA9 01608E0A