Skip to main content
1 of 3

Remote ssh command not sending echo variable from a ksh script on AIX

I'm need to get the value of a variable from a remote host in a script using ssh and have to source an environment file first that does a shift at the end of it's run. The command works locally and I can see what it's doing with an echo. I've spent a good day researching this and testing every combination of single and double quotes I could find. I hope someone has a quick solution.

The first ssh command returns "YES" which is what I expect. How do I get the second variable to the remote host without it being expanded? Thanks...

Here's the script:

#!/bin/ksh

set -x

SIDHost=p16

ThisSID=test

ssh -q $SIDHost ". /tmp/useq $ThisSID; echo $HOST_IS_ERPDB"

ERPTest=`ssh -q ${SIDHost} ". /usr/vmmc/bin/oracle_scripts/useq $ThisSID; echo $HOST_IS_ERPDB"`

Script run:

+ SIDHost=p16

+ ThisSID=test

+ ssh -q p16 . /usr/vmmc/bin/oracle_scripts/useq test; echo $HOST_IS_ERPDB

YES

+ + ssh -q p16 . /usr/vmmc/bin/oracle_scripts/useq test; echo NO

ERPTest=NO