title: Bash script get user and change dir
body: <p>How can I combine these two examples with pushd and whoami to change the directory?</p>
  
  <p>I know I can change the directory like this:</p>
  
  <pre><code>#!/bin/bash
  pushd /home/mike/Pictures &gt; /dev/null
  # do something in the new dir
  ls
  popd &gt; /dev/null
  </code></pre>
  
  <p>And I know I can get the username like this:</p>
  
  <pre><code>#!/bin/bash
  theuser=`whoami`
  echo $theuser        
  </code></pre>