This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print_relative_dir() { | |
re="^$HOME(/?.*)" | |
[[ "$PWD" =~ $re ]] && echo "~${BASH_REMATCH[1]}" || echo "$PWD" | |
} | |
is_workspace() { | |
# Path on macOS will begin with /Volumes | |
re="^(/Volumes)?(/google/src/cloud)/(${USER})/([^/]+)(/.*)?" | |
dir="$PWD" | |
[[ "$dir" =~ $re ]] && return 0 || return 1 |