bandwidth test script

Hi,

I want to make a script, which can run a bandwidth test and send me an email about the avarage bandwidth. I know how to make a bandwith test script, but i dont know how to send the values.
Can somebody help me how to write this script?

Thank you
Balázs Szele

re,

tool bandwidth-test xxx.xxx.xx.x duration=5s direction=both protocol=tcp file=result , but it saves the first value
this:
status: connecting
duration: 0s
tx-current: 0bps
tx-10-second-average: 0bps
tx-total-average: 0bps
rx-current: 0bps
rx-10-second-average: 0bps
rx-total-average: 0bps
random-data: no
direction: both


but i need the last value like this:
status: done testing
duration: 5s
tx-current: 4.8Mbps
tx-10-second-average: 4.2Mbps
tx-total-average: 4.2Mbps
rx-current: 4.5Mbps
rx-10-second-average: 4.4Mbps
rx-total-average: 4.4Mbps
random-data: no
direction: both
Anybody knows how to save the last value?

please help me out

thanks

Balazs Szele