Closed JamesRH closed 11 years ago
I have fixed this by removing the executable bit and adding a message when it is run (or sourced unfortunately, I couldn't find a way around this in my quick search but if you find one let me know) telling users that the file is intended to be sourced and will not work if it is run. Not sure I like the idea of wrapping the script since in order to make it most convenient it should be sourced from .bashrc anyway so it just makes more work for people to figure out what to do with it.
Since SourceMe.sh will not change the bash variables if run instead of sourced (as the user returns to their own shell before the exports occurred), we should remove the executable bit (and maybe change it to SourceMe.path or something). We should also make it clear in the docs that it should be sourced, not run.
Alternatively, we could make a wrapper script (SourceMe.sh) that sources the actual file (SourceMe.path), which would open up the possability of allowing the user to specify a file to concatenate to ( SourceMe.sh ~/.profile => cat SourceMe.path >> ~/.profile ). There is probably some way to do an if/then and combine the two in the same file.