Last part of script to remote host not working...

Hi,

I got most of the script working, last part which does the ssh to remote and execute the command not working.

for SSH in ${HostList}; do
    echo ${SSH}
    echo ""
    SSH2SEND=ssh user@${SSH} curl -v $URL
    echo $SSH2SEND
done

error message I am getting       user@10.xx.xx.xx: command not found

There's obviously a double quote missing.

Thanks. I fix the double quote but now I get command not found.

Quote the string

    SSH2SEND="ssh user@${SSH} curl -v $URL"

Please DON'T modify posts that have been referred to by others pulling the rug from under them!

You need to use "command substitution" like

SSH2SEND=$(ssh user@${SSH} curl -v $URL)

I added the quote back on. Now I don't get any error message but it doesn't do anything. it just prints this on the screen.

for SSH in ${HostList}; do
    echo ${SSH}
    echo ""
    SSH2SEND="ssh user@${SSH} curl -v $URL"
    echo $SSH2SEND
done

Here is the output...

ssh user@10.xx.xx.xx curl -v test.com
10.xx.xx.xx

ssh user@10.xx.xx.xx curl -v test.com
10.xx.xx.xx

ssh user@10.xx.xx.xx curl -v test.com
10.xx.xx.xx

ssh user@10.xx.xx.xx curl -v test.com
10.xx.xx.xx

ssh user@10.xx.xx.xx curl -v test.com
10.xx.xx.xx

ssh user@10.xx.xx.xx curl -v test.com

---------- Post updated at 02:24 PM ---------- Previous update was at 01:37 PM ----------

I think i am close but not 100%. I updated the script. now I get SSH error message.

line 69: (ssh: command not found
(ssh user@10.xx.xx.xx curl -v test.com)