Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

$0 does not work when .profile is sourced #3

Closed
mikehale opened this Issue Aug 15, 2012 · 0 comments

Comments

Projects
None yet
2 participants

When attempting to use the .profile generated by an anvil build $0 breaks. I put together a simple example:

The script:

$ cat tmp.sh 
#!/bin/bash

set -x

echo "$(dirname $0)"

Running the script works:

$ ./tmp.sh
++ 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?

@ddollar ddollar closed this in 2b9bd63 Aug 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment