I'm trying to make a bash script to pipe a new alias to .bash_aliases and then source .bashrc:
#!/bin/sh
FIRST=$1
SECOND=${2:-cd `pwd`}
if [ -z $1 ]
then
cat ~/.bash_aliases # no arg, show aliases
else
echo alias $FIRST="'$SECOND'" >> ~/.bash_aliases
. /home/andreas/.bashrc
fi
The . /home/andreas/.bashrc part doesn't work.
Following this I've tried running the script this way source . ./myscript.
And following this I've tried adding PS1='foobar' to the script before the . /home/andreas/.bashrc line.
Neither works.