Shell/perl script to connect to different servers in single login in teradata

Hi,
I want to write a shell script to compare two tables in teradata.these tables are present on different servers.
I want to connect to both servers in single login in order to fetch and compare the data in one go.

Thanks

I'm not familiar with 'teradata' but it sort of sounds like a GIS database? If so, the actual process of extracting and comparing the data will be something you'll have to derive but I can help with the method of obtaining this data from two different servers.

#!/bin/sh
"get data from server" > /tmp/localfile
ssh "username"@"remoteserver" "get data from server" | diff - /tmp/localfile