brew: Conciser error when run from nonexistent directory

This commit is contained in:
Andrew Janke 2018-05-26 05:30:35 -04:00
parent e4c02fafda
commit 00e21bfdf7

View File

@ -1,6 +1,12 @@
#!/bin/bash
set +o posix
# Fail fast with concise message when cwd does not exist
if ! [[ -d "$PWD" ]]; then
echo "Error: The current working directory doesn't exist, cannot proceed." >&2
exit 1
fi
quiet_cd() {
cd "$@" >/dev/null
}