[ale] Bash Prompt Programming Question

James P. Kinney III jkinney at localnetsolutions.com
Wed May 21 20:32:12 EDT 2003


On Wed, 2003-05-21 at 20:16, Jonathan Glass wrote:

> 
> Assuming correct syntax...what do I do to echo out the stdout from the
> "test-telnet.pl" command, while running a test against it?  IE,
> # truly ugly pseudo-code
> for i in `seq 250 254`
> do
> if (`test-telnet 111.222.333.$i <mac address>` | grep -c "Port 25" > 0)
> then
>   i++;
> else
>   echo out stdout from `test-telnet`
>   break loop
> end if
> done

Make a simple test-telnet that just echo's out 4 lines of your choice.

#!/usr/bin/perl

$fred="\nLocation        VLAN ID Permanent\nUnit 1 Port 25     1      
No\n\n";
$mary="\nLocation        VLAN ID Permanent\nUnit 1 Port 26     1      
No\n\n";


if ($1 eq 111.222.333.252) {print "$fred"}
else {print "$mary"}
exit
-- 
James P. Kinney III          \Changing the mobile computing world/
CEO & Director of Engineering \          one Linux user         /
Local Net Solutions,LLC        \           at a time.          /
770-493-8244                    \.___________________________./
http://www.localnetsolutions.com

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics) <jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7 

 This is a digitally signed message part




More information about the Ale mailing list