title: Set alias within bash script
body: <p>I'm trying to create an alias in a script like so:</p>
  
  <pre><code>#!/bin/bash
  shopt -s expand_aliases
  
  #Currently just using 'git' to try and get it working
  #It'll be replaced with the following line when it works
  #compgen -c | while read x;
  echo 'git' | while read x;
    do
      a=`echo $x | tr '[:lower:]' '[:upper:]'`;
      echo $a;
      echo $x;
      if [ "$a" != '' ]
      then
        echo 'got here';
        alias $a=$x;
        alias;
        GIT;
      fi
  done
  </code></pre>
  
  <p>While a simple test script works (<code>testme</code> is added to the aliases in my current shell):</p>
  
  <pre><code>#!/bin/bash
  shopt -s expand_aliases
  alias testme="echo It Worked"
  alias
  testme
  </code></pre>
  
  <p>Output from first script:</p>
  
  <pre><code>GIT
  git
  got here
  alias GIT='git'
  alias grep='grep --colour=auto'
  alias ls='ls --color=auto'
  GIT: command not found
  </code></pre>
  
  <p><code>GIT</code> shows up in the aliases, but can't be executed.  I've tried calling it with <code>. ./script.sh</code> and <code>source script.sh</code>. What am I doing wrong?</p>