Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 157

How to break ping command without waiting for its complete output in expect programming?

$
0
0

I am new to expect programming. In my script i need to run multiple ping commands.

I am running below mentioned command: ping $ip rep 100 size 1500

If connection is successful than its all good, but if ping response will not come, then it will keep pinging device till 100 rep, which is taking a lot of time. I want to break it in between and switch to next command if i got output of command like this:

Type escape sequence to abort. Sending 100, 1500-byte ICMP Echos to $ip, timeout is 2 seconds: .......

I have tried breaking it with regex and different ASCII codes, but every other option is working only after 100 pings to device.

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>