[ale] Bash Prompt Programming Question

Jonathan Glass jonathan.glass at ibb.gatech.edu
Wed May 21 20:16:28 EDT 2003



> On Wed, 2003-05-21 at 19:31, Jonathan Glass wrote:
<snip>
>> When I call my Perl::Telnet script, I do so in a for loop, seen here:
>> ------script2.sh------
>> for i in `cut -f 2 -d " " test-macs.txt | sed s/\:/\-/g`
>> do
>> echo $i
>>   for j in `seq 250 253`
>>   do
>>   echo 111.222.333.$j
> if {
>>   '/home/jglass/perl/test-telnet.pl 111.222.333.$j "$i" | grep -c
>> "Port 25"' > 0 }
>           do stuff here
> fi
>>  done
>> done
>> -----end script2.sh---
>>
>> The "test-telnet.pl" script returns the following output:
>>
>> --------output--------
>>
>> Location        VLAN ID Permanent
>> Unit 1 Port 25     1       No
>>
>> ------end output------
>> The output literally has a blank line, the Location & Unit line, then
>> a closing blank line, courtesy of the network equipment.
>>
>>
> Double check my syntax. I may have merged bash, perl and python.
>>
>> Thanks
> --
> James P. Kinney III          \Changing the mobile computing world/ CEO &
>

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

-- 
Jonathan Glass
System Support Specialist II
Institute for Bioengineering & Biosciences (IBB)



_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list