3 ms·
Those scripts are exactly the ones where I don't want to be in the script's directory. Something like this is more like what I use: project=$(git rev-parse
by bazzargh 4y ago
Those scripts are exactly the ones where I don't want to be in the script's directory. Something like this is more like what I use:
project=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
ie, find the top of the git project, if there isn't one, use the current dir. My scripts live in ~/bin or similar and aren't where I want them to run.