Re: /dev/tcp feature request...

2025-04-12 Thread MacBeth
On Wed, Apr 9, 2025 at 8:48 AM A. James Lewis wrote: > > Yes, this is how I am doing it currently, but remember that once you > cut that subshell loose, you cannot easily get a response from it and > certainly can't pass variables back... and you are more or less forced > to wait for a sensible ti

Re: /dev/tcp feature request...

2025-04-11 Thread microsuxx
++ On Fri, Apr 11, 2025, 17:21 Chet Ramey wrote: > On 4/11/25 11:03 AM, microsuxx wrote: > > same error as eof i'd say .. > > No. The file descriptor is invalid. There is a difference between a read > error (-1/EINVAL) and EOF (0). > > -- > ``The lyf so short, the craft so long to lerne.'' - Cha

Re: /dev/tcp feature request...

2025-04-11 Thread Chet Ramey
On 4/10/25 7:51 PM, A. James Lewis wrote: I'm not quite sure about that, I would be trying to get back the file descriptor to use for a period and then close it... so if it fails to open, then I don't know if "redirection error" makes sense, but then again, I'm not sure what would the correct err

Re: /dev/tcp feature request...

2025-04-11 Thread Chet Ramey
On 4/11/25 11:03 AM, microsuxx wrote: same error as eof i'd say .. No. The file descriptor is invalid. There is a difference between a read error (-1/EINVAL) and EOF (0). -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Ch

Re: /dev/tcp feature request...

2025-04-11 Thread microsuxx
same error as eof i'd say .. On Fri, Apr 11, 2025, 01:53 A. James Lewis wrote: > I'm not quite sure about that, I would be trying to get back the file > descriptor to use for a period and then close it... so if it fails to > open, then I don't know if "redirection error" makes sense, but then >

Re: /dev/tcp feature request...

2025-04-10 Thread A. James Lewis
I'm not quite sure about that, I would be trying to get back the file descriptor to use for a period and then close it... so if it fails to open, then I don't know if "redirection error" makes sense, but then again, I'm not sure what would the correct error be. Certainly I would just be checking f

Re: /dev/tcp feature request...

2025-04-10 Thread Oğuz
On Tuesday, April 8, 2025, A. James Lewis wrote: > > I have however found it extremely frustrating to open TCP connections > via /dev/tcp, because there appears to be no way to control the > timeout! Same. It'd be nice if bash gave up after $TMOUT seconds -- Oğuz

Re: /dev/tcp feature request...

2025-04-10 Thread Chet Ramey
On 4/7/25 6:24 PM, A. James Lewis wrote: I've not been around this mailing list all too long, so I don't know if this has been debated before, but I have always attempted to avoid using external programs where functionality within bash can meet a requirement. Doing this allows my scripts to be m

Re: /dev/tcp feature request...

2025-04-09 Thread A. James Lewis
Yes, this is how I am doing it currently, but remember that once you cut that subshell loose, you cannot easily get a response from it and certainly can't pass variables back... and you are more or less forced to wait for a sensible timeout, even tho the actual connection might take a much short

Re: /dev/tcp feature request...

2025-04-08 Thread microsuxx
[[ -d /proc/"$!" ]] On Tue, Apr 8, 2025, 16:33 Andreas Schwab wrote: > On Apr 08 2025, MacBeth wrote: > > > while ((dur /dev/null; do > > You can use kill -0 $! to check if the process still exists. > > -- > Andreas Schwab, SUSE Labs, sch...@suse.de > GPG Key fingerprint = 0196 BAD8 1CE9 197

Re: /dev/tcp feature request...

2025-04-08 Thread Andreas Schwab
On Apr 08 2025, MacBeth wrote: > while ((dur /dev/null; do You can use kill -0 $! to check if the process still exists. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: /dev/tcp feature request...

2025-04-08 Thread MacBeth
On Tue, Apr 8, 2025 at 8:54 AM MacBeth wrote: > > On Mon, Apr 7, 2025 at 5:37 PM A. James Lewis wrote: > > > > I have always attempted to avoid > > using external programs where functionality within bash can meet a > > requirement. Doing this allows my scripts to be more reliable, and not > > de

Re: /dev/tcp feature request...

2025-04-08 Thread MacBeth
On Tue, Apr 8, 2025 at 8:54 AM MacBeth wrote: > > script begin ... sample output being: $ . tcp.sh HTTP/1.0 200 OK Done with: www.google.com HTTP/1.0 200 OK Done with: www.example.com sleeping... waiting on 8.8.8.9 sleeping... waiting on 8.8.8.9 sleeping... waiting on 8.8.8.9 sleeping... wa

Re: /dev/tcp feature request...

2025-04-08 Thread MacBeth
On Mon, Apr 7, 2025 at 5:37 PM A. James Lewis wrote: > > I have always attempted to avoid > using external programs where functionality within bash can meet a > requirement. Doing this allows my scripts to be more reliable, and not > depend on those external tools being installed... > > I have ho

Re: /dev/tcp feature request...

2025-04-08 Thread MacBeth
On Tue, Apr 8, 2025 at 7:16 AM Zachary Santer wrote: > > Is there a good tutorial on how to actually use /dev/tcp? > I found a number of helpful results on google... https://www.google.com/search?q=%2Fdev%2Ftcp For instance: https://medium.com/@stefanos.kalandaridis/bash-ing-your-network-

Re: /dev/tcp feature request...

2025-04-08 Thread Zachary Santer
On Tue, Apr 8, 2025 at 7:04 AM Greg Wooledge wrote: > > On Tue, Apr 08, 2025 at 06:34:50 +0300, Oğuz wrote: > > On Tuesday, April 8, 2025, A. James Lewis wrote: > > > I have however found it extremely frustrating to open TCP connections > > > via /dev/tcp, because there appears to be no way to co

Re: /dev/tcp feature request...

2025-04-08 Thread Greg Wooledge
On Tue, Apr 08, 2025 at 06:34:50 +0300, Oğuz wrote: > On Tuesday, April 8, 2025, A. James Lewis wrote: > > I have however found it extremely frustrating to open TCP connections > > via /dev/tcp, because there appears to be no way to control the > > timeout! > > Same. It'd be nice if bash gave up

/dev/tcp feature request...

2025-04-07 Thread A. James Lewis
I've not been around this mailing list all too long, so I don't know if this has been debated before, but I have always attempted to avoid using external programs where functionality within bash can meet a requirement. Doing this allows my scripts to be more reliable, and not depend on those exter