title: ZSH: execute function in a script file
body: <p>I have a <code>~/scripts/git-workflow.sh</code> file that looks like:</p>
  
  <pre><code>#!/bin/zsh
  
  gp() {
    local cmd="git pull"
    echo "=&gt; $cmd"
    $cmd
  }
  </code></pre>
  
  <p>It's basically a nicer alias, that will print out the command when I use my alias so I don't forget the actual commands over time.</p>
  
  <p>In my <code>.zshrc</code> file, I <code>source ~/scripts/git-workflow.sh</code>.</p>
  
  <p>At my zsh prompt, when I execute <code>$ gp</code> it seems to run the function but fails.</p>
  
  <pre><code>$ gp
  =&gt; git pull
  gp:5: command not found: git pull
  </code></pre>
  
  <p>However, if I execute <code>$ git pull</code> directly on the command-line, it runs just fine.</p>
  
  <pre><code>$ git pull
  Already up to date.
  </code></pre>
  
  <p>This was working fine when I was using <code>bash</code>, but I recently switched to <code>zsh</code> (thanks to Apple using it as the default) and have been having issues executing my scripts.</p>
  
  <p>Is there some special format I need to put my function in, or something I need to add to zsh to make this work?</p>