When attempting to use the .profile generated by an anvil build $0 breaks. I put together a simple example:
$ cat tmp.sh
echo "$(dirname $0)"
Running the script works:
++ dirname ./tmp.sh
+ echo .
Sourcing it does not (I think this is similar to how .profile will be called from /etc/profile):
$ source tmp.sh
+++ dirname -su
dirname: invalid option -- 's'
Try `dirname --help' for more information.
++ echo ''
I think perhaps this is related: http://tldp.org/LDP/abs/html/othertypesv.html#FTN.AEN2436
Can we assume that .profile will always be in $HOME?
dont rely on $0, fixes #3