title: How to change directory in shell script?
body: <p>I have written below script to get access of SSH:</p>
  
  <pre><code>#!/usr/bin/expect -f
  
  spawn ssh 123456 -p 2222
  expect "password:"
  send "foopassword\r"
  interact
  </code></pre>
  
  <p><code>#!/usr/bin/expect -f</code> only works for me now as we will have to automate the password entry as well. </p>
  
  <p>later after logging, trying to do <code>cd /xyz/directory</code>, but that's not working. </p>
  
  <p>Given try referring to related posts and stored the path as alias inside Bash file, but still no luck.</p>
  
  <p><a href="https://askubuntu.com/questions/481715/why-doesnt-cd-work-in-a-shell-script">https://askubuntu.com/questions/481715/why-doesnt-cd-work-in-a-shell-script</a></p>
  
  <p>How to <code>cd</code> to some path and do <code>ls</code> and <code>read</code> the content after ssh logging? Is it possible to do from Bash scripts?</p>