title: Mac Shell script get home directory
body: <p>I need to get the home directory in my shell script so my coworkers can run it. What my shell does is really simple, it only copy some directories to another. I've used:  </p>
  
  <blockquote>
    <p>$HOME,<br>
    $(whoami)<br>
    even this:<br>
    ABSPATH=$(cd "$(dirname "$0")"; pwd),  </p>
  </blockquote>
  
  <p>but when I use the variable like this:</p>
  
  <blockquote>
    <p>DIR= $ABSPATH/folder/afolder/bfolder/</p>
  </blockquote>
  
  <p>and run it I receive this:</p>
  
  <blockquote>
    <p>/Users/theUser/Desktop/FusionTest.command: line 14: /Users/theUser/Desktop/folder/afolder/bfolder: is a directory<br>
    Copying  to 
    usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
           cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
    logout<br>
    [Process completed]</p>
  </blockquote>
  
  <p>I'm using the command cp -r to copy all files and directories.</p>
  
  <p>Whay I am missing? or how can I do this?? </p>