title: Bash Script read hostnames from .txt file and place in variable for ssh
body: <p>I created a Bash Script that is the following:</p>
  
  <pre><code>File=/library/logs/file.txt
  ssh -n username@&lt;ip&gt; "$(&lt; testscript.sh)" &gt; $File 
  </code></pre>
  
  <p>It will remote into a machine and run a script and place the output in file.txt
  What I need to do now is instead of manually entering an ip address, I need to have it read from a list of hostnames coming from a .txt file and have it place it in a variable that will substitute the ip address. An example would be: ssh username@Variable in which "Variable" will be changing each time a word is read from a file containing hostnames. Any ideas how to go about this?</p>