Prefer $(pwd) to $PWD

I'm unsure if this is idiomatic POSIX shell scripting or not, but I generally
prefer function calls to variables. Thankfully things like Haskell don't
differentiate between the two. In other cold and hostile environments like shell
scripting, us programmers must take care to prefer functions to variables where
it makes sense.
This commit is contained in:
William Carroll 2019-03-23 16:38:19 +00:00
parent 7167764622
commit f5ace0b0a9

View file

@ -9,7 +9,7 @@ fv() {
tbz() {
# Toggle between blaze-bin and your source.
# Useful if you like to cd into the dir where your source lives.
if [[ $PWD =~ '(.*)/blaze-bin(.*)' ]]; then
if [[ "$(pwd)" =~ '(.*)/blaze-bin(.*)' ]]; then
cd "${match[1]}${match[2]}"
else
cd "${PWD/\/google3//google3/blaze-bin}"