I have an if statement I use to find if a file exists on another server. While testing with the file not on the other server it is returning true which suggests it is only looking on the current server even though I have used ssh to connect to the other server.
if [ 'ssh $USER@$IP_ADDRESS test -e -name "$IPADDRESS:$DIRECTORY/$FILE"' ];
You don't need to test again result returned by ssh, so no need in
ssh will return 0 (True) if remote
test succeeded, so:
if `ssh $USER@$IP_ADDRESS test -e -name "$IPADDRESS:$DIRECTORY/$FILE"`; then # do something if True fi