I am accessing a remote machine using the ssh command and a pem file. My code is as follows:
#!/bin/bash
ssh -i rijo.pem [email protected] <<EOF
sudo -s
var=`cat /opt/revsw-config/varnish/sites/rijotests4934567_revsw_net.json | egrep 'SERVER_NAME' | cut -b 19-44`
EOF
When I use this script, I am not able to store the value into the variable but if I run the command in the terminal it works. When I run the script, I get a No such file or directory found
error.
Can u please help me in this.
./yourscript.sh
, try it running by:. ./yourscript.sh
– Tejas Jan 7 at 10:59