What is the proper way to pass variable from one machine to another machine via bash script? In the below code I am trying to get the input from user and want to pass the same to remote machine, but the value is not getting accessed in remote machine, can anyone let me know the proper way to do it?
NEWLINE=$'\n'
read -s -p "Enter App FQDN:${NEWLINE}" APP_FQDN
read -s -p "Enter App Password:${NEWLINE}" APP_PASSWORD
read -s -p "Enter VD Password:${NEWLINE}" VD_PASSWORD
sshpass -p "$APP_PASSWORD" ssh -o StrictHostKeyChecking=no -T root@$APP_FQDN << 'EOSSH'
if true; then
su - presto << 'PRESTO'
source ~/.bash_profile
cd /opt/vm/vchs/presto_agent
pwd
KEY=$( cat /opt/vm/vchs/presto_agent/config/settings.yml |grep '^key:'|sed 's/^key: //')
echo $KEY
echo $VD_PASSWORD
PASSWORD=$(ruby /opt/vm/vchs/presto_agent/lib/obfuscation_util.rb encrypt $KEY $VD_PASSWORD)
echo $PASSWORD
PRESTO
else
echo "False"
fi
EOSSH
While executing the above script $VD_PASSWORD
is echo blanks