I've got the following in a bash script
ssh -T -i ${ssh_key} ${ssh_user}@${host} <<- 'EOF'
file=`hostname`.tar.gz
echo "file: " $file
### prints>> file: some-host-name.tar.gz
EOF
scp -i ${ssh_key} ${ssh_user}@${host}:${file} ~/incoming
### prints>> scp -i /home/user/.ssh/key.pem [email protected]: ~/incoming
I'm trying to set the filename inside the heredoc, as it's based on the host I'm connecting to. I then want to use that filename to scp the file to another location, but I can't get the filename outside of the heredoc.
Suggestions?
'EOF'
, no expansion was performed in body of here-document. Anyway, variable assignment was not performed inside here-document.