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'sits 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?
Here's the script:
#!/bin/ksh
set -x
SIDHost=p16
ThisSID=test
ssh -q $SIDHost "". /tmp/useq $ThisSID; echo \$HOST_IS_ERPDB"
\$HOST_IS_ERPDB"
ERPTest=\`sshERPTest=`ssh -q ${SIDHost} "". /usr/vmmc/bin/oracle_scripts/useq $ThisSID; echo \$HOST_IS_ERPDB"\`\$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