Re: how to set timeout for 'read' command
From: nasir (nasir.kamal_at_gmail.com)
Date: 07/07/05
- Next message: Chris F.A. Johnson: "Re: spaces to dashes with exception"
- Previous message: Sebastian Luque: "Re: spaces to dashes with exception"
- In reply to: Icarus Sparry: "Re: how to set timeout for 'read' command"
- Next in thread: Icarus Sparry: "Re: how to set timeout for 'read' command"
- Reply: Icarus Sparry: "Re: how to set timeout for 'read' command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Jul 2005 07:03:16 -0700
Icarus Sparry wrote:
> > I changed it to /dev/tcp/10.100.1.1/29 where tcp/29 is an unused port
> > and no service is running on that. Ideally it should timeout after 15
> > seconds, but I get the following output immediately:
> >
>
> If the host 10.100.1.1 is accessible, then this is the correct behavior.
> The shell will attempt to connect to that TCP port, get an error response,
> and will therefore fail the shell 'read' command. If you remove the
> s>/dev/null on line 9 you will probably get an error message telling you
> this.
No luck, I tried with IP(10.100.1.1) live and Port(29) blocked. And to
dead non responding IP as well. Same behaviour. It should not be the
same. I dont have any problem if the IP do no exist (do not respond at
all) in my original script. The problem I am having is with an IP which
is live/responding but not responding to certain port (in my case
SSH(tcp/22)).
P.S. Mind that I am originally working on SSH or tcp/22 port, the port
29 I am using just for testing to simulate a non-responding
service/port.
thanks.
>
> This is the same as doing
> read fred < /file/name/that/does/not/exist
> It doesn't hang in the read, just in case you later create the file.
>
> You might have to change the 'sh' to 'ksh' on line 4 if your 'sh' and OS
> do not know about /dev/tcp.
- Next message: Chris F.A. Johnson: "Re: spaces to dashes with exception"
- Previous message: Sebastian Luque: "Re: spaces to dashes with exception"
- In reply to: Icarus Sparry: "Re: how to set timeout for 'read' command"
- Next in thread: Icarus Sparry: "Re: how to set timeout for 'read' command"
- Reply: Icarus Sparry: "Re: how to set timeout for 'read' command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|