Cannot connect to host by SSH.
I am using following shell script to use ssh
.
host_list="c15-0330-14.ad.mtu.edu"
ssh "$host_list"
But It always says : Name or service not knownname c15-0330-14.ad.mtu.edu
.
I tried ssh c15-0330-14.ad.mtu.edu
. It works.
Also, If I have several hosts, how can I invoke them one by one?
The error message should be
ssh: Could not resolve hostname c15-0330-14.ad.mtu.edu: Name or service not known
except the DOS line endings in your script cause an extra carriage return to be stored at the end of the value of host_list
. This carriage return, when printed as part of the error message, causes the cursor to return to the beginning of the line, resulting in the error message you actually see. Notice how the two halves line up (the carriage return immediately precedes the colon):
ssh: Could not resolve hostname c15-0330-14.ad.mtu.edu
: Name or service not known
results in your error of
: Name or service not knownname c15-0330-14.ad.mtu.edu
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With