zsh-workers
 help / color / mirror / code / Atom feed
* Fw: poor man's wget
@ 2000-05-30 12:35 Andrej Borsenkow
  2000-05-30 15:05 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Andrej Borsenkow @ 2000-05-30 12:35 UTC (permalink / raw)
  To: ZSH workers mailing list


I found it on c.u.s

Amusing is it :-)

-andrej

"brian hiles" <bsh@rainey.blueneptune.com> wrote in message
news:<sj2npdk15pj111@corp.supernews.com>...
> Martin Ramsch <m.ramsch@computer.org> 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 <hostname> 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 </dev/udp/0.0.0.0/13; print -r -- "$REPLY"
>
> -Brian


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fw: poor man's wget
  2000-05-30 12:35 Fw: poor man's wget Andrej Borsenkow
@ 2000-05-30 15:05 ` Peter Stephenson
  2000-05-30 15:57   ` Zefram
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2000-05-30 15:05 UTC (permalink / raw)
  To: Zsh hackers list

> > { echo GET /; echo; cat; } <>/dev/tcp/www.server.com/80

This could be done without much difficulty by simplifying zftp_open and
wiring the code into the existing redirection stuff.  Unfortunately no-one
else apart from Zefram has shown much interest in the network stuff, so
it's unlikely to happen any time soon.

You could probably then rewrite most if not all of zftp as shell functions.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fw: poor man's wget
  2000-05-30 15:05 ` Peter Stephenson
@ 2000-05-30 15:57   ` Zefram
  0 siblings, 0 replies; 3+ messages in thread
From: Zefram @ 2000-05-30 15:57 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

Peter Stephenson wrote:
>> > { echo GET /; echo; cat; } <>/dev/tcp/www.server.com/80

Having the shell give pathnames magic semantics that the rest of the
OS doesn't is evil and rude.  That sort of feature should be done in a
user-space filesystem.

>This could be done without much difficulty by simplifying zftp_open and
>wiring the code into the existing redirection stuff.  Unfortunately no-one
>else apart from Zefram has shown much interest in the network stuff, so
>it's unlikely to happen any time soon.

Hmm.  I do have some future plans for a shell module that would do
generic socket stuff of this nature (using a more rational syntax),
though, as you say, it's unlikely to happen any time soon.

>You could probably then rewrite most if not all of zftp as shell functions.

Yes.

-zefram


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-05-30 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-30 12:35 Fw: poor man's wget Andrej Borsenkow
2000-05-30 15:05 ` Peter Stephenson
2000-05-30 15:57   ` Zefram

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).