I have written a shell script to run other shell script on remote server(Shell script is running successfully on remote server). I want to capture output to some variable. Below is my code.
Please can anyone help me out.
#! /bin/sh
sshpass -p password ssh -T root@serverIP1 << EOF
sshpass -p password ssh -T root@serverIP2 << EOS
copyoutput=bash /opt/Shellscriptlocation/DiskSpace.sh
EOS
EOF
echo $copyoutput