title: Read-command in bash script
body: <p>I'm trying to start using read -r, but no luck so far.
  The following script (added below) should make a list of SSH servers from /etc/hosts, and then execute the command. I use it for simple administration things, adding users, etc. </p>
  
  <p>I normally use <code>sshservers=($(&lt;serverlist.txt))</code>, but I ran my script through Shellcheck last week, and it said I should use <code>read -r</code> in stead.
  So I added that, but now my script gets stuck when I run it. </p>
  
  <p>Is someone able to help me out how I should properly use <code>read -r</code> in stead?
  (And if you have any further tips or notes, please let me know, I'm still learning Bash, as you might see by looking at my script hehe). </p>
  
  <p>Thanks in advance! </p>
  
  <pre><code>#!/bin/bash
  serverlist=/home/demo/serverlist.txt
  : &gt; "$serverlist"
  sed -e '/^#/d' /etc/hosts | awk '{print $2}' &gt;&gt; "$serverlist"
  sed -i -- '/^localhost/ d' "$serverlist"
  #sshservers=($(&lt;serverlist.txt))
  sshservers=$(read serverlist)
  for sshserver in "${sshservers[@]}"
          do
          ssh -t demo@"$sshserver" "hostname &amp;&amp; sudo ls /root/"
  done
  echo "done"
  </code></pre>
  
  <p>EDIT: /home/demo/serverlist.txt contains IP's with the following format, not sure if it helps:</p>
  
  <pre><code>192.168.1.1
  192.168.1.2
  192.168.1.3 
  </code></pre>