title: SSH exited without connecting to server in shell script
body: <p>I am trying to connect to the servers and cd into each directory. But when I tried to SSH into the first server which is <strong>server1</strong>, the error it gave me was  </p>
  
  <blockquote>
    <p>Pseudo-terminal will not be allocated because stdin is not a terminal.</p>
  </blockquote>
  
  <p>This is the config file and bash script below:</p>
  
  <p>getPatches.cfg</p>
  
  <pre><code>SERVERLIST="server1;server2"
  USERNAME=bob
  DIRECTORY=/net/bob
  </code></pre>
  
  <p>bash script</p>
  
  <pre><code>#!/bin/sh
  
  CFGFILE=getPatches.cfg
  
  if ! [ -f $CFGFILE ] ; then
     echo "ERROR: $CFGFILE configuration file is missing"
     exit 1
  fi
  # READ $CFGFILE
  . $CFGFILE
  servers=$SERVERLIST
  user=$USERNAME
  directory=$DIRECTORY
  
  #Tokenize ServerList
  while IFS=';' read -ra ADDR; do
          for i in "${ADDR[@]}"; do
                  ssh $user@$i
                  AccessIntoDirectory="cd $directory"
                  export AccessIntoDirectory
                  ssh -q $i $AccessIntoDirectory
          done
  done &lt;&lt;&lt; "$servers"
  </code></pre>
  
  <p>I've generated a SSH public key and what this script should do is to SSH into the server and cd into the directory that I want, but it exited instead and did not SSH into the server. Any help would be great!</p>