Script to source bin/thisroot.sh

Hello,
I am having a problem with a little bash script I wrote; here it is

#!/bin/bash

echo "Moving to the root directory..."
cd /home/$USER/root-6.02.08/
echo "Executing the script..."
source bin/thisroot.sh
echo "Moving back to /home/$USER..."
cd /home/$USER
echo "Done."

It doesn’t seem to work; could anybody help me out? My current OS is Linux Mint 17, and when I manually do what the script does root works flawlessly…
Thanks

Well, doing “source bin/thisroot.sh” will setup ROOT inside of your shell script, but it will not be visible outside.
Try to create a shell alias:
alias myroot=". /home/${USER}/root-6.02.08/bin/thisroot.sh"
or a shell function:
myroot() { . /home/${USER}/root-6.02.08/bin/thisroot.sh; }

That was roughly what I thought. Thanks for the advice, it worked perfectly