From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28178 invoked from network); 30 May 2000 12:35:58 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 May 2000 12:35:58 -0000 Received: (qmail 14682 invoked by alias); 30 May 2000 12:35:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11659 Received: (qmail 14668 invoked from network); 30 May 2000 12:35:43 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) From: "Andrej Borsenkow" To: "ZSH workers mailing list" Subject: Fw: poor man's wget Date: Tue, 30 May 2000 16:35:40 +0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 I found it on c.u.s Amusing is it :-) -andrej "brian hiles" wrote in message news:... > Martin Ramsch wrote: > > I only now discovered the special handling of redirections to > > /dev/tcp/host/port introduced with Bash 2.x, and I like this small > > contruct which requests the main page from a web server: > > { echo "GET /" >&0; cat; } <>/dev/tcp/www.server.com/80 > > Also the first time a "<>" redirection is useful for me ... ;-) > > The /dev/{tcp,udp} special notation is a reflection of the same > feature introduced in ksh93 (at least I think I'm getting the > relationship correct!) BTW, "<>" is an undocumented feature of > plain ol'd bourne shell since, well, _forever_. > > Jeffery Korn (yes, son of _that_ guy) posted a similar solution two > years of so back to this newsgroup. > > Apparently, however, bash 2.x does ksh93 one better by not requiring > the address to be resolved to an IP address. Kudoes to > the bash development team :) > > Incidentally, I would rephrase the above as: > > { echo GET /; echo; cat; } <>/dev/tcp/www.server.com/80 > > Isn't the additional newline necessary? (Not tested.) > > It's quite amusing to determine the time from a daytime server: > > read -r > -Brian