I have an "installer" script that installs a couple scripts and a directory for them. This works as expected. In the middle of my script I also have an alias I inject into the local .bashrc so that the script can be called from the commandline:
echo -e "..........Adding Alias"
echo "alias Change=~/ChangeTool/Change" >> .bashrc
echo -e "..............Recompiling environment"
. ~/.bashrc
I can confirm it does show up in my .bashrc when I run the installer. However, if I rm -rf my script directory, remove the line from (and recompile with . ./.bashrc) my .bashrc, and reinstall, I get "Change command not found".
I then thought to myself "o.k., I'll try again." so I remove the line and recompile bashrc myself. I more .bashrc and it's no longer there. Out of curiosity I tried the Change command and it worked.
Is there just some weird delay with installing aliases?
Edit: Here is the output on fresh install:
PSTSAUTO@MUXALRM:~$ ./installer.sh
Installing [ ASR9K CHANGE TOOL ]
..........Targeting /home/PSTSAUTO/
..........Getting raw tarball
..............Extracting the tarball
..........Adding Alias
..............Recompiling environment
..........Install Complete.
PSTSAUTO@MUXALRM:~$ Change
Change: command not found
PSTSAUTO@MUXALRM:~$ grep "Change" .bashrc
alias Change=~/ChangeTool/Change
PSTSAUTO@MUXALRM:~$
So it's there but it doesn't work. As stated in code snippet above I did try to source with the . command.