C shell scripting, check if link exists on remote servers

Hi, I'm new to C Shell programming. I'm trying to check if a sym link exists on remote server if not send email. I'm not having much luck. Can anyone help?

Here is what I have written but it doesn't work. It tells me that my variable was not defined. Here is part of the script, the second "foreach" where it says " #check for sym link " doesn't work:

set vMasterServer = "test6"
set vEnvPath = "/db01/app/ora10se"
set vTempServerList = "$vEnvPath/test"
set vTNSPath = "/export/home/dbesync"
set vTNSFile = "testfile.ora"
set vTNSLink = `ls -F testfile.ora`
foreach vEnvServer ( "`cat $vTempServerList | grep -v $vMasterServer`" )
#Get Server Name from the file
set vServerName = `echo $vEnvServer`
echo $vServerName

if ( $vServerName != $vMasterServer ) then
#Ensure the server is online!
/usr/sbin/ping $vServerName

if ( $status == 0 ) then
echo "Secure Copy $vTNSFile to $vTNSPath on $vServerName. : `date`"
ssh -t $vUnixAcct@${vServerName} >& /dev/null <<EOF
cd ${vTNSPath}
cp -p ${vTNSFile} ${vTNSFile}.BAK

#check for sym link

foreach vTNSAdminFolder ( "`ls -l $vTNSPath | grep ^d | grep "list*"`" )
cd $vTNSAdminFolder
if ( "$vTNSLink != tnsnames.ora@" ) then
#Page group to fix link
$vSendPageFile $vPageWho "$vJobName $vServerName $vTNSAdminFolder ERROR: tnsnames.ora not symbolic link. PLEASE FIX." > /dev/null
endif
end

logout
EOF
endif
endif
end