Addresses [shell scripts may fail if 'cd' writes to stdout](https://fuchsia.atlassian.net/browse/ZX-3212)

Updated all //scripts/* scripts using cd to find a path, to suppress
output, and calls to vars.sh now check for an error status.

Output is suppressed by redirecting stdout to /dev/null.
stderr is also redirected to
/dev/null to ensure there are no unintended side effects of calling
"cd" in a subshell (avoids unintentional escape sequences, such as
updating a terminal window title bar to the wrong directory).

Note that I found multiple ways the default (builtin) version of cd
can output to stdout. GNU bash can output the path to stdout in
some situations if CDPATH is set. zsh can output the path to stdout
even if CDPATH is not set.

Change-Id: I47da2bac4decd7c7ee8a325f9385d0fc4060aabe
diff --git a/build-qemu.sh b/build-qemu.sh
index 9401a16..eec1b44 100755
--- a/build-qemu.sh
+++ b/build-qemu.sh
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 readonly ROOT_DIR="$(dirname "${SCRIPT_DIR}")"
 
 readonly HOST_ARCH="$(uname -m)"
@@ -79,10 +79,10 @@
 while getopts "cd:j:o:s:" opt; do
   case "${opt}" in
     c) CLEAN="true" ;;
-    d) DESTDIR="$(cd "${OPTARG}"; pwd -P)" ;;
+    d) DESTDIR="$(cd "${OPTARG}" >/dev/null 2>&1; pwd -P)" ;;
     j) JOBS="${OPTARG}" ;;
-    o) OUTDIR="$(cd "${OPTARG}"; pwd -P)" ;;
-    s) SRCDIR="$(cd "${OPTARG}"; pwd -P)" ;;
+    o) OUTDIR="$(cd "${OPTARG}" >/dev/null 2>&1; pwd -P)" ;;
+    s) SRCDIR="$(cd "${OPTARG}" >/dev/null 2>&1; pwd -P)" ;;
     *) usage;;
   esac
 done
diff --git a/build-zircon.sh b/build-zircon.sh
index 6a9cc09..f18edf4 100755
--- a/build-zircon.sh
+++ b/build-zircon.sh
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 readonly ROOT_DIR="$(dirname "${SCRIPT_DIR}")"
 
 JOBS=`getconf _NPROCESSORS_ONLN` || {
diff --git a/check-gn-format b/check-gn-format
index 9347b69..83e0417 100755
--- a/check-gn-format
+++ b/check-gn-format
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 readonly BUILDTOOLS_DIR="${SCRIPT_DIR}/../buildtools"
 readonly GN="${BUILDTOOLS_DIR}/gn"
 
diff --git a/devshell/add-driver b/devshell/add-driver
index 1a85b0d..488fa2b 100755
--- a/devshell/add-driver
+++ b/devshell/add-driver
@@ -11,7 +11,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 if [[ $# -eq 0 ]]; then
diff --git a/devshell/add-update-source b/devshell/add-update-source
index c75b5ad..264c897 100755
--- a/devshell/add-update-source
+++ b/devshell/add-update-source
@@ -18,7 +18,7 @@
 ## --name=NAME           Name the generated update source config NAME. Defaults to the config type.
 ## --disable-source=NAME Disable the update source with NAME after adding the new update source.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage {
diff --git a/devshell/blobstats b/devshell/blobstats
index df9f624..3c025ed 100755
--- a/devshell/blobstats
+++ b/devshell/blobstats
@@ -5,8 +5,8 @@
 
 ### compute some blobfs statistics from the build
 
-DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-source "${DEVSHELL_DIR}/lib/vars.sh"
+DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+source "${DEVSHELL_DIR}/lib/vars.sh" || exit $?
 fx-config-read
 
 case "$(uname -s)" in
diff --git a/devshell/build b/devshell/build
index 5489f46..97ae565 100755
--- a/devshell/build
+++ b/devshell/build
@@ -7,7 +7,7 @@
 
 ## usage: fx build [ninja option,...] [target,...]
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function main {
diff --git a/devshell/build-push b/devshell/build-push
index a3c33d5..d484807 100755
--- a/devshell/build-push
+++ b/devshell/build-push
@@ -15,7 +15,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function main {
@@ -49,4 +49,4 @@
   fx-command-run push-package "${targets[@]}"
 }
 
-main "$@"
\ No newline at end of file
+main "$@"
diff --git a/devshell/build-zircon b/devshell/build-zircon
index ce40a55..2071072 100755
--- a/devshell/build-zircon
+++ b/devshell/build-zircon
@@ -5,7 +5,7 @@
 
 ### build the kernel
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 echo "Building zircon..."
diff --git a/devshell/clean b/devshell/clean
index 96cee1b..cc59db1 100755
--- a/devshell/clean
+++ b/devshell/clean
@@ -9,7 +9,7 @@
 ##   gn clean out/x64
 ## It is useful to clean the build directory without having to re-gen.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 set -ex
diff --git a/devshell/clean-build b/devshell/clean-build
index 22a5f81..729f601 100755
--- a/devshell/clean-build
+++ b/devshell/clean-build
@@ -9,7 +9,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 rm -rf -- "${FUCHSIA_DIR}/out"
 fx-command-run set "$@"
diff --git a/devshell/compdb b/devshell/compdb
index 00760b0..eaa12c0 100755
--- a/devshell/compdb
+++ b/devshell/compdb
@@ -9,7 +9,7 @@
 ##        -z|--zircon to additonally generate compile_commands.json for Zircon
 ##        -z option also concatenates the two compile_commands.json
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 generate_zircon () {
@@ -39,7 +39,7 @@
         ;;
     esac
 
-    source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+    source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
     fx-config-read
 
     fx-try-locked "${FUCHSIA_DIR}/buildtools/gn" gen "${FUCHSIA_BUILD_DIR}" --export-compile-commands
diff --git a/devshell/cp b/devshell/cp
index af475c6..a39e81b 100755
--- a/devshell/cp
+++ b/devshell/cp
@@ -15,7 +15,7 @@
 ## The default is to copy files to the target.
 
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 to_target=true
 if [[ $# -eq 3 ]]; then
diff --git a/devshell/dart-remote-test b/devshell/dart-remote-test
index 561215b..a33271f 100755
--- a/devshell/dart-remote-test
+++ b/devshell/dart-remote-test
@@ -17,9 +17,9 @@
 ## Arguments:
 ##   -h|--help    Print out this message.
 
-DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 VERBOSE=false
-source "${DEVSHELL_DIR}"/lib/vars.sh
+source "${DEVSHELL_DIR}"/lib/vars.sh || exit $?
 fx-config-read
 
 case $1 in
diff --git a/devshell/dart-tunnel b/devshell/dart-tunnel
index 0b529fe..16748be 100755
--- a/devshell/dart-tunnel
+++ b/devshell/dart-tunnel
@@ -18,9 +18,9 @@
 ## Arguments:
 ##   -h|--help    Print out this message.
 
-DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 VERBOSE=false
-source "${DEVSHELL_DIR}"/lib/vars.sh
+source "${DEVSHELL_DIR}"/lib/vars.sh || exit $?
 fx-config-read
 
 case $1 in
diff --git a/devshell/debug b/devshell/debug
index ee5b81f..654d9c0 100755
--- a/devshell/debug
+++ b/devshell/debug
@@ -25,7 +25,7 @@
 ##                      Useful for debugging the debugger. Yo' dawg.
 ##
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 # Defaults.
diff --git a/devshell/debug-report b/devshell/debug-report
index bd89257..6b0d126 100755
--- a/devshell/debug-report
+++ b/devshell/debug-report
@@ -25,7 +25,7 @@
 ##            out components. Only matching components will be included in the
 ##            report.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 # Defaults.
 system_objects=false
diff --git a/devshell/delta b/devshell/delta
index 1454101..d7d5ab3 100755
--- a/devshell/delta
+++ b/devshell/delta
@@ -14,7 +14,7 @@
 ##   --build          Build the current package snapshot before comparing it to the previously saved snapshot
 ##   DELTA_ARGS       Unknown arguments are passed through to "pm delta"
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage {
diff --git a/devshell/exec b/devshell/exec
index fe8745e..a2eb5fb 100755
--- a/devshell/exec
+++ b/devshell/exec
@@ -8,7 +8,7 @@
 ## usage: fx exec <command> [args, ...]
 ## The build configuration is sourced and read, then command is executed.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 exec "$@"
diff --git a/devshell/flash b/devshell/flash
index 4c5f544..d1e6f37 100755
--- a/devshell/flash
+++ b/devshell/flash
@@ -16,7 +16,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/image_build_vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/image_build_vars.sh || exit $?
 
 usage() {
     fx-command-help
diff --git a/devshell/flutter-attach b/devshell/flutter-attach
index 3e78c4b..595ea13 100755
--- a/devshell/flutter-attach
+++ b/devshell/flutter-attach
@@ -13,8 +13,8 @@
 ##   -v|--verbose Enable verbose logging.
 ##   -h|--help    Print out this message.
 
-DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-source "${DEVSHELL_DIR}"/lib/vars.sh
+DEVSHELL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+source "${DEVSHELL_DIR}"/lib/vars.sh || exit $?
 fx-config-read
 
 ARGS=()
diff --git a/devshell/format-code b/devshell/format-code
index f9b4744..c51c02f 100755
--- a/devshell/format-code
+++ b/devshell/format-code
@@ -29,7 +29,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 function usage() {
   fx-command-help
diff --git a/devshell/full-build b/devshell/full-build
index 1bac376..3fb0c5a 100755
--- a/devshell/full-build
+++ b/devshell/full-build
@@ -8,7 +8,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 fx-command-run build-zircon
-fx-command-run build
\ No newline at end of file
+fx-command-run build
diff --git a/devshell/fuzz b/devshell/fuzz
index b071172..5349fc1 100755
--- a/devshell/fuzz
+++ b/devshell/fuzz
@@ -80,7 +80,7 @@
 ##   8. Save the new, minimized corpus in CIPD:
 ##         fx fuzz store foo/bar
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 # Constants
diff --git a/devshell/gce b/devshell/gce
index 2b684fc..d165c6f 100755
--- a/devshell/gce
+++ b/devshell/gce
@@ -7,7 +7,7 @@
 
 ## See `fx gce help` for more imformation.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 "${FUCHSIA_DIR}/scripts/gce/gce" "$@"
diff --git a/devshell/gen b/devshell/gen
index 3aa0c35..0fb852f 100755
--- a/devshell/gen
+++ b/devshell/gen
@@ -10,9 +10,9 @@
 ## It is useful if one has by some mechanism deleted the ninja artifacts, but
 #not the args.gn, e.g. if one CTRL+C's a regen step (gn bug).
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 set -ex
 
-"${FUCHSIA_DIR}/buildtools/gn" gen "$FUCHSIA_BUILD_DIR" "$@"
\ No newline at end of file
+"${FUCHSIA_DIR}/buildtools/gn" gen "$FUCHSIA_BUILD_DIR" "$@"
diff --git a/devshell/get-build-dir b/devshell/get-build-dir
index a589f4c..c858a7b 100755
--- a/devshell/get-build-dir
+++ b/devshell/get-build-dir
@@ -7,7 +7,7 @@
 
 ## equivalent to `fx exec echo ${FUCHSIA_BUILD_DIR}`
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 echo "${FUCHSIA_BUILD_DIR}"
diff --git a/devshell/go b/devshell/go
index 815c9eb..1c9fea0 100755
--- a/devshell/go
+++ b/devshell/go
@@ -8,7 +8,7 @@
 ##  fx go <go tool args>
 ##  fx go --package=packagename <go tool args>
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage {
diff --git a/devshell/lib/add_symlink_to_bin.sh b/devshell/lib/add_symlink_to_bin.sh
index e331682..2b9af46 100755
--- a/devshell/lib/add_symlink_to_bin.sh
+++ b/devshell/lib/add_symlink_to_bin.sh
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-devshell_lib_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+devshell_lib_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 FUCHSIA_DIR="$(dirname $(dirname $(dirname "${devshell_lib_dir}")))"
 
 if [[ -d "${FUCHSIA_DIR}/.jiri_root/bin" ]]; then
diff --git a/devshell/lib/image_build_vars.sh b/devshell/lib/image_build_vars.sh
index 1d2b4cd..51ae1f2 100644
--- a/devshell/lib/image_build_vars.sh
+++ b/devshell/lib/image_build_vars.sh
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/vars.sh || return $?
 fx-config-read
 
 source "${FUCHSIA_BUILD_DIR}"/image_paths.sh
diff --git a/devshell/lib/vars.sh b/devshell/lib/vars.sh
index fdcfa5e..9b9b69b7 100644
--- a/devshell/lib/vars.sh
+++ b/devshell/lib/vars.sh
@@ -5,7 +5,7 @@
 if [[ -n "${ZSH_VERSION}" ]]; then
   devshell_lib_dir=${${(%):-%x}:a:h}
 else
-  devshell_lib_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+  devshell_lib_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 fi
 
 export FUCHSIA_DIR="$(dirname $(dirname $(dirname "${devshell_lib_dir}")))"
diff --git a/devshell/log b/devshell/log
index 32d4481..1d8c0ff 100755
--- a/devshell/log
+++ b/devshell/log
@@ -12,7 +12,7 @@
 set -e
 set -o pipefail
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 if [[ $# > 0 && $1 = "--raw" ]]; then
diff --git a/devshell/make-fuchsia-vol b/devshell/make-fuchsia-vol
index a6fa8e8..32aa908 100755
--- a/devshell/make-fuchsia-vol
+++ b/devshell/make-fuchsia-vol
@@ -5,7 +5,7 @@
 
 ### build a fuchsia persistent disk
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
-"${FUCHSIA_BUILD_DIR}/tools/make-fuchsia-vol" "$@"
\ No newline at end of file
+"${FUCHSIA_BUILD_DIR}/tools/make-fuchsia-vol" "$@"
diff --git a/devshell/mkzedboot b/devshell/mkzedboot
index 4c3890d..2b73bc7 100755
--- a/devshell/mkzedboot
+++ b/devshell/mkzedboot
@@ -11,7 +11,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/image_build_vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/image_build_vars.sh || exit $?
 
 if [[ "${FUCHSIA_ARCH}" != "x64" ]]; then
   echo >&2 mkzedboot is not supported for ${FUCHSIA_ARCH}
diff --git a/devshell/net-run b/devshell/net-run
index e2bc333..8b77742 100755
--- a/devshell/net-run
+++ b/devshell/net-run
@@ -25,7 +25,7 @@
 ##    SSH_COMMAND   Any other argument will be passed directly to "fx ssh".
 ##                  If not specified, it will open an interactive SSH session.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 # Defaults
 # If --run is set, it will overwrite this value
diff --git a/devshell/netaddr b/devshell/netaddr
index 9db7c3e..d58dd8b 100755
--- a/devshell/netaddr
+++ b/devshell/netaddr
@@ -7,7 +7,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 "${ZIRCON_TOOLS_DIR}/netaddr" --nowait "$@"
diff --git a/devshell/netboot b/devshell/netboot
index 9818be7..03fdeb5 100755
--- a/devshell/netboot
+++ b/devshell/netboot
@@ -9,7 +9,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 name_args=()
@@ -18,4 +18,4 @@
   name_args+=("-n" "${name}")
 fi
 
-exec "${FUCHSIA_BUILD_DIR}/netboot.sh" "${name_args[@]}" "$@"
\ No newline at end of file
+exec "${FUCHSIA_BUILD_DIR}/netboot.sh" "${name_args[@]}" "$@"
diff --git a/devshell/netls b/devshell/netls
index 93ddbac..27ada98 100755
--- a/devshell/netls
+++ b/devshell/netls
@@ -7,7 +7,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 "${ZIRCON_TOOLS_DIR}/netls" "$@"
diff --git a/devshell/old-symbolize b/devshell/old-symbolize
index a1f8ace..33bbf78 100755
--- a/devshell/old-symbolize
+++ b/devshell/old-symbolize
@@ -5,7 +5,7 @@
 
 ### symbolize call stacks provided as input
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 # TODO(jeffbrown): Fix symbolize to support arch other than x64
diff --git a/devshell/ota b/devshell/ota
index 5dc338f..a4e3a96 100755
--- a/devshell/ota
+++ b/devshell/ota
@@ -18,7 +18,7 @@
 ##                specified, will connect to the only available
 ##                device on the link-local network.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function main {
diff --git a/devshell/pave b/devshell/pave
index 413771a..4a19a38 100755
--- a/devshell/pave
+++ b/devshell/pave
@@ -9,7 +9,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 name_args=()
@@ -18,4 +18,4 @@
   name_args+=("-n" "${name}")
 fi
 
-exec "${FUCHSIA_BUILD_DIR}/pave.sh" "${name_args[@]}" --authorized-keys "${FUCHSIA_DIR}/.ssh/authorized_keys" "$@"
\ No newline at end of file
+exec "${FUCHSIA_BUILD_DIR}/pave.sh" "${name_args[@]}" --authorized-keys "${FUCHSIA_DIR}/.ssh/authorized_keys" "$@"
diff --git a/devshell/push-package b/devshell/push-package
index 20e38d9..36ddc01 100755
--- a/devshell/push-package
+++ b/devshell/push-package
@@ -15,7 +15,7 @@
 ## See https://fuchsia.googlesource.com/docs/+/master/development/workflows/package_update.md
 ## for more information about using this workflow.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage {
diff --git a/devshell/reboot b/devshell/reboot
index f9f43b3..b4d47f6 100755
--- a/devshell/reboot
+++ b/devshell/reboot
@@ -14,7 +14,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage() {
diff --git a/devshell/run b/devshell/run
index d2157ea..eb2e069 100755
--- a/devshell/run
+++ b/devshell/run
@@ -11,7 +11,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/image_build_vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/image_build_vars.sh || exit $?
 source "${FUCHSIA_DIR}/buildtools/vars.sh"
 
 while getopts ":S:h" FLAG; do
diff --git a/devshell/run-host-tests b/devshell/run-host-tests
index 9693d73..6104b2b 100755
--- a/devshell/run-host-tests
+++ b/devshell/run-host-tests
@@ -17,7 +17,7 @@
 set -o errexit
 set -o pipefail
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 ARGS=()
diff --git a/devshell/run-netboot b/devshell/run-netboot
index e6f2c05..5b7035d 100755
--- a/devshell/run-netboot
+++ b/devshell/run-netboot
@@ -5,7 +5,7 @@
 
 ### start fuchsia in qemu via netboot
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/image_build_vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/image_build_vars.sh || exit $?
 source "${FUCHSIA_DIR}/buildtools/vars.sh"
 
 qemu_dir="${BUILDTOOLS_QEMU_DIR}/bin"
diff --git a/devshell/run-test b/devshell/run-test
index a48b13f..e7dd4c5 100755
--- a/devshell/run-test
+++ b/devshell/run-test
@@ -11,7 +11,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage {
diff --git a/devshell/run-test-component b/devshell/run-test-component
index fb2dca4..4f99212 100755
--- a/devshell/run-test-component
+++ b/devshell/run-test-component
@@ -19,7 +19,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage {
diff --git a/devshell/save-package-stats b/devshell/save-package-stats
index 72dbee6..5b5417f 100755
--- a/devshell/save-package-stats
+++ b/devshell/save-package-stats
@@ -12,7 +12,7 @@
 ##   --name|-n NAME   Set the NAME of the package snapshot (Default: "system")
 ##   OUTPUT_PATH      Write the snapshot at the specified OUTPUT_PATH (Default: $FUCHSIA_BUILD_DIR/snapshots/$NAME.snapshot)
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage {
diff --git a/devshell/scp b/devshell/scp
index eda6e28..b86dbfb 100755
--- a/devshell/scp
+++ b/devshell/scp
@@ -14,7 +14,7 @@
 ##
 ##   fx scp "[$(fx netaddr --fuchsia)]:source_file" dest_file
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 case $1 in
diff --git a/devshell/screenshot b/devshell/screenshot
index ef82ae0..87730b1 100755
--- a/devshell/screenshot
+++ b/devshell/screenshot
@@ -23,7 +23,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 OUT=screencap.ppm
diff --git a/devshell/serve b/devshell/serve
index fd97406..7d32b87 100755
--- a/devshell/serve
+++ b/devshell/serve
@@ -8,7 +8,7 @@
 ##   -l host:port for "pm serve" to listen on
 ##   -v enable more verbose output (must be first argument)
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 kill_child_processes() {
diff --git a/devshell/serve-updates b/devshell/serve-updates
index dfb2c4b..b0f56ff 100755
--- a/devshell/serve-updates
+++ b/devshell/serve-updates
@@ -8,7 +8,7 @@
 ##   -l host:port for "pm serve" to listen on
 ##   -v verbose (do not suppress `pm serve` output)
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 function usage {
diff --git a/devshell/set b/devshell/set
index d88a6ab..83d7b7c 100755
--- a/devshell/set
+++ b/devshell/set
@@ -120,7 +120,7 @@
 ##                         This flag is deprecated, please use one of
 ##                         --available, --preinstall, or --monolith.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 function guess_config_within_layer {
   local config_type="$1"
@@ -432,7 +432,7 @@
     *)
       # Absolute or relative path.  Canonicalize it to source-relative.
       local abs_build_dir
-      abs_build_dir="$(cd "${build_dir%/*}"; pwd)/${build_dir##*/}" || {
+      abs_build_dir="$(cd "${build_dir%/*}" >/dev/null 2>&1; pwd)/${build_dir##*/}" || {
         echo >&2 "ERROR: Missing parent directories for ${build_dir}"
         return 1
       }
diff --git a/devshell/set-clock b/devshell/set-clock
index e94cd57..fa307ae 100755
--- a/devshell/set-clock
+++ b/devshell/set-clock
@@ -5,7 +5,7 @@
 
 ### set the clock on target using host clock
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 if [[ "$(uname -s)" = "Darwin" ]]; then
   device_date=`date +%Y-%m-%dT%T`
diff --git a/devshell/set-device b/devshell/set-device
index cdcd9d2..21cd5a5 100755
--- a/devshell/set-device
+++ b/devshell/set-device
@@ -21,7 +21,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-standard-switches "$@"
 fx-config-read
 
@@ -46,4 +46,4 @@
 fi
 
 echo "New default device: ${device}"
-echo "$device" > "${FUCHSIA_BUILD_DIR}.device"
\ No newline at end of file
+echo "$device" > "${FUCHSIA_BUILD_DIR}.device"
diff --git a/devshell/set-petal b/devshell/set-petal
index 3b2f9f1..68b2216 100755
--- a/devshell/set-petal
+++ b/devshell/set-petal
@@ -11,7 +11,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 if [[ "$#" -ne 1 ]]; then
   fx-command-help
diff --git a/devshell/setup-macos b/devshell/setup-macos
index 66f59f6..bd2b3c7 100755
--- a/devshell/setup-macos
+++ b/devshell/setup-macos
@@ -4,7 +4,7 @@
 # found in the LICENSE file.
 
 # Run this command in Fuchsia development environment, or at minimum,
-# source ${FUCHSIA_DIR}/scripts/devshell/lib/vars.sh
+# source ${FUCHSIA_DIR}/scripts/devshell/lib/vars.sh || exit $?
 
 ### register Zircon tools at MacOS Application Firewall
 
diff --git a/devshell/sftp b/devshell/sftp
index 0aff714..4f5d956 100755
--- a/devshell/sftp
+++ b/devshell/sftp
@@ -15,7 +15,7 @@
 ##
 ##   fx sftp "[$(fx netaddr --fuchsia)]:source_file" dest_file
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 case $1 in
diff --git a/devshell/shell b/devshell/shell
index 59980b1..f7e93ea 100755
--- a/devshell/shell
+++ b/devshell/shell
@@ -12,7 +12,7 @@
 ## Arguments:
 ##   -h|--help    Print out this message.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 case $1 in
   -h|--help)
@@ -31,4 +31,4 @@
 # failures much harder to diagnose when helping people. The control master will
 # mean you only get one per TCP socket, which is once per newly booted host.
 # It's not a huge burden compared to end user support.
-fx-command-exec ssh "${device_addr}" "$@"
\ No newline at end of file
+fx-command-exec ssh "${device_addr}" "$@"
diff --git a/devshell/ssh b/devshell/ssh
index 5828b99..fd8ba96 100755
--- a/devshell/ssh
+++ b/devshell/ssh
@@ -5,7 +5,7 @@
 
 ### invoke ssh with the keys from $FUCHSIA_BUILD_DIR/ssh-keys
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 # Note: I know there are people who don't like the host-key message, but DO NOT
@@ -13,4 +13,4 @@
 # failures much harder to diagnose when helping people. The control master will
 # mean you only get one per TCP socket, which is once per newly booted host.
 # It's not a huge burden compared to end user support.
-SSH_AUTH_SOCK="" exec ssh -F "${FUCHSIA_BUILD_DIR}/ssh-keys/ssh_config" "$@"
\ No newline at end of file
+SSH_AUTH_SOCK="" exec ssh -F "${FUCHSIA_BUILD_DIR}/ssh-keys/ssh_config" "$@"
diff --git a/devshell/symbolize b/devshell/symbolize
index a29107a..d338a08 100755
--- a/devshell/symbolize
+++ b/devshell/symbolize
@@ -10,7 +10,7 @@
 ## Anything that is not valid marked up is left alone. This is similar
 ## to how c++filt works for demangling C++ symbols.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 if [[ $# > 1 && "$1" = "-i" ]]; then
diff --git a/devshell/syslog b/devshell/syslog
index 7fe3f6e..34d7bb9 100755
--- a/devshell/syslog
+++ b/devshell/syslog
@@ -13,7 +13,7 @@
 
 set -o pipefail
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 function listen {
   while true; do
diff --git a/devshell/tests/build_test.sh b/devshell/tests/build_test.sh
index f478090..b2d7136 100755
--- a/devshell/tests/build_test.sh
+++ b/devshell/tests/build_test.sh
@@ -13,7 +13,7 @@
   exit 1
 fi
 
-readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 readonly FUCHSIA_DIR="$(dirname "$(dirname "$(dirname "${SCRIPT_DIR}")")")"
 readonly BUILD_DIR="foo"
 readonly TEST_BUILD_DIR="${TEST_DIR}/${BUILD_DIR}"
diff --git a/devshell/unset-device b/devshell/unset-device
index dd5d595..0577bf7 100755
--- a/devshell/unset-device
+++ b/devshell/unset-device
@@ -12,10 +12,10 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-standard-switches "$@"
 fx-config-read
 
 if [[ -n "${FUCHSIA_BUILD_DIR}" ]]; then
   rm -f "${FUCHSIA_BUILD_DIR}.device"
-fi
\ No newline at end of file
+fi
diff --git a/devshell/update-rustc-third-party b/devshell/update-rustc-third-party
index 808aaf4..555be39 100755
--- a/devshell/update-rustc-third-party
+++ b/devshell/update-rustc-third-party
@@ -16,7 +16,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 case "$(uname -s)" in
   Linux*) OS=linux-x64;;
diff --git a/devshell/use b/devshell/use
index 9d8acfd..a02505d 100755
--- a/devshell/use
+++ b/devshell/use
@@ -13,7 +13,7 @@
 ## such command will now refer to DIR.  The previous build directory is
 ## left in place, so you can switch back again with `fx use` later.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 function main {
   if [[ $# -ne 1 ]]; then
diff --git a/devshell/vendor b/devshell/vendor
index f16af06..f09661e 100755
--- a/devshell/vendor
+++ b/devshell/vendor
@@ -7,7 +7,7 @@
 
 ## usage: fx vendor <vendor-dir> [command]
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 function main {
   if [[ $# -lt 2 ]]; then
@@ -38,4 +38,4 @@
   exec "${vendor_cmd_path}" "$@"
 }
 
-main "$@"
\ No newline at end of file
+main "$@"
diff --git a/devshell/verify-build-packages b/devshell/verify-build-packages
index dbb79ff..1bf05cf 100755
--- a/devshell/verify-build-packages
+++ b/devshell/verify-build-packages
@@ -9,7 +9,7 @@
 
 set -e
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 fx-config-read
 
 if [[ "$#" -ne 1 ]]; then
diff --git a/devshell/wait b/devshell/wait
index 050f832..8685300 100755
--- a/devshell/wait
+++ b/devshell/wait
@@ -10,7 +10,7 @@
 ## Attempts to SSH to the target repeatedly until the target becomes
 ## available.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
 
 device_addr=""
 until [[ -n "${device_addr}" ]]; do
@@ -19,4 +19,4 @@
 until fx-command-run ssh "${device_addr}" \
   -o ConnectionAttempts=1 -o ConnectTimeout=1 echo >/dev/null 2>&1; do
   echo -n
-done
\ No newline at end of file
+done
diff --git a/fx b/fx
index 7d4bdf1..acf5242 100755
--- a/fx
+++ b/fx
@@ -136,7 +136,7 @@
 fi
 
 declare -r vars_sh="${fuchsia_dir}/scripts/devshell/lib/vars.sh"
-source "${vars_sh}"
+source "${vars_sh}" || exit $?
 
 while [[ $# -ne 0 ]]; do
   case $1 in
diff --git a/fx-env.sh b/fx-env.sh
index dccf279..e5eb91c 100755
--- a/fx-env.sh
+++ b/fx-env.sh
@@ -3,9 +3,9 @@
 # found in the LICENSE file.
 
 if [[ -n "${ZSH_VERSION}" ]]; then
-  source "$(cd "$(dirname "${(%):-%x}")" && pwd)"/devshell/lib/vars.sh
+  source "$(cd "$(dirname "${(%):-%x}")" >/dev/null 2>&1 && pwd)"/devshell/lib/vars.sh || return $?
 else
-  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/devshell/lib/vars.sh
+  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/devshell/lib/vars.sh || return $?
 fi
 
 # __patched_path <old-regex> <new-component>
diff --git a/fx-wrapper b/fx-wrapper
index 4b4b243..749a6d9 100755
--- a/fx-wrapper
+++ b/fx-wrapper
@@ -6,6 +6,6 @@
 # This script is a wrapper around the fx script that allows it to be run from
 # a current working directory outside the fuchsia source tree.
 
-export FUCHSIA_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+export FUCHSIA_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd)"
 
 exec ${FUCHSIA_DIR}/scripts/fx "$@"
diff --git a/gce/create-fuchsia-image.sh b/gce/create-fuchsia-image.sh
index 94b3bcd..0831426 100755
--- a/gce/create-fuchsia-image.sh
+++ b/gce/create-fuchsia-image.sh
@@ -4,7 +4,7 @@
 # found in the LICENSE file.
 
 if [[ -z $FUCHSIA_GCE_PROJECT ]]; then
-  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/env.sh
+  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/env.sh
 fi
 
 $FUCHSIA_DIR/scripts/gce/gce make-fuchsia-image "$@" || exit 1
diff --git a/gce/create-instance.sh b/gce/create-instance.sh
index e0598f4..9ead3d2 100755
--- a/gce/create-instance.sh
+++ b/gce/create-instance.sh
@@ -4,7 +4,7 @@
 # found in the LICENSE file.
 
 if [[ -z $FUCHSIA_GCE_PROJECT ]]; then
-  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/env.sh
+  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/env.sh
 fi
 
 # gcloud -q compute disks create "$FUCHSIA_GCE_DISK" --guest-os-features=UEFI_COMPATIBLE --image "$FUCHSIA_GCE_IMAGE" || exit
diff --git a/gce/delete-instance.sh b/gce/delete-instance.sh
index 1562fe3..eee7041 100755
--- a/gce/delete-instance.sh
+++ b/gce/delete-instance.sh
@@ -4,7 +4,7 @@
 # found in the LICENSE file.
 
 if [[ -z $FUCHSIA_GCE_PROJECT ]]; then
-  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/env.sh
+  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/env.sh
 fi
 
-gcloud compute instances delete $FUCHSIA_GCE_INSTANCE
\ No newline at end of file
+gcloud compute instances delete $FUCHSIA_GCE_INSTANCE
diff --git a/gce/env.sh b/gce/env.sh
index e5077a4..b4ad610 100755
--- a/gce/env.sh
+++ b/gce/env.sh
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/../devshell/lib/vars.sh
+source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../devshell/lib/vars.sh || exit $?
 fx-config-read
 
 get-gcloud-config() {
diff --git a/gce/gce b/gce/gce
index 0656596..0589fa1 100755
--- a/gce/gce
+++ b/gce/gce
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-mydir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+mydir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 if [[ -z $FUCHSIA_GCE_PROJECT ]]; then
   source $mydir/env.sh
 fi
diff --git a/gce/make-fuchsia-image.sh b/gce/make-fuchsia-image.sh
index b85f39a..cf8a482 100755
--- a/gce/make-fuchsia-image.sh
+++ b/gce/make-fuchsia-image.sh
@@ -4,7 +4,7 @@
 # found in the LICENSE file.
 
 if [[ -z $FUCHSIA_GCE_PROJECT ]]; then
-  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/env.sh
+  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/env.sh
 fi
 
 mfv=$FUCHSIA_BUILD_DIR/tools/make-fuchsia-vol
diff --git a/gce/serial.sh b/gce/serial.sh
index af3619f..3f40d90 100755
--- a/gce/serial.sh
+++ b/gce/serial.sh
@@ -4,7 +4,7 @@
 # found in the LICENSE file.
 
 if [[ -z $FUCHSIA_GCE_PROJECT ]]; then
-  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/env.sh
+  source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/env.sh
 fi
 
 # ctlpath frequently gets too long here, so instead, just ssh without it.
diff --git a/gdb/build-gdb.sh b/gdb/build-gdb.sh
index ac797de..170879b 100755
--- a/gdb/build-gdb.sh
+++ b/gdb/build-gdb.sh
@@ -5,7 +5,7 @@
 
 set -eo pipefail
 
-readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. >/dev/null 2>&1 && pwd)"
 
 # N.B. This must be an absolute path.
 readonly ROOT_DIR="$(dirname "${SCRIPT_DIR}")"
diff --git a/run-zircon-arm64 b/run-zircon-arm64
index 3fa415a..6492034 100755
--- a/run-zircon-arm64
+++ b/run-zircon-arm64
@@ -6,7 +6,7 @@
 # license that can be found in the LICENSE file or at
 # https://opensource.org/licenses/MIT
 
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
 exec $DIR/../zircon/scripts/run-zircon -a arm64 \
     -o $DIR/../out/build-zircon/build-arm64 "$@"
diff --git a/run-zircon-x86 b/run-zircon-x86
index 9d7f1e1..d26fe5d 100755
--- a/run-zircon-x86
+++ b/run-zircon-x86
@@ -6,7 +6,7 @@
 # license that can be found in the LICENSE file or at
 # https://opensource.org/licenses/MIT
 
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
 exec $DIR/../zircon/scripts/run-zircon -a x64 \
     -o $DIR/../out/build-zircon/build-x64 "$@"
diff --git a/rust/build_cargo_vendor.sh b/rust/build_cargo_vendor.sh
index 2952883..27c0fae 100755
--- a/rust/build_cargo_vendor.sh
+++ b/rust/build_cargo_vendor.sh
@@ -7,7 +7,7 @@
 # cannot be built from sources in the Fuchsia tree AND cannot be installed via
 # "cargo install"...
 
-readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 readonly ROOT_DIR="$(dirname $(dirname "${SCRIPT_DIR}"))"
 
 if [[ "$(uname -s)" = "Darwin" ]]; then
diff --git a/rust/install_cargo_vendor.sh b/rust/install_cargo_vendor.sh
index 3b58068..01e34bf 100755
--- a/rust/install_cargo_vendor.sh
+++ b/rust/install_cargo_vendor.sh
@@ -6,7 +6,7 @@
 # NOTE: installing cargo-vendor manually is currently necessary as cargo-vendor
 # cannot be built from sources in the Fuchsia tree.
 
-readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 readonly ROOT_DIR="$(dirname $(dirname "${SCRIPT_DIR}"))"
 
 if [[ "$(uname -s)" = "Darwin" ]]; then
diff --git a/rust/rustdoc_no_ld_library_path.sh b/rust/rustdoc_no_ld_library_path.sh
index ba0c597..bb38e23 100755
--- a/rust/rustdoc_no_ld_library_path.sh
+++ b/rust/rustdoc_no_ld_library_path.sh
@@ -8,7 +8,7 @@
 #
 # TODO(cramertj) remove pending fix to our builds of cargo doc to prevent this
 
-readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 readonly ROOT_DIR="$(dirname $(dirname "${SCRIPT_DIR}"))"
 
 if [[ "$(uname -s)" = "Darwin" ]]; then
diff --git a/tests/pave-prebuilt-tests b/tests/pave-prebuilt-tests
index bc148f0..bbdf7d6 100755
--- a/tests/pave-prebuilt-tests
+++ b/tests/pave-prebuilt-tests
@@ -12,7 +12,7 @@
 set -o pipefail
 
 # Read in the tool under test. Set TESTING=1 to avoid invoking main().
-readonly PARENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly PARENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 TESTING=1 source "${PARENT_DIR}/../pave-prebuilt"
 
 # expect_archive_produces_id <archive-path> <expected-id>
diff --git a/zsh-completion/_fx b/zsh-completion/_fx
index 45a17d7..09d415f 100644
--- a/zsh-completion/_fx
+++ b/zsh-completion/_fx
@@ -8,12 +8,12 @@
 
 __fx_amber_package() {
   # packages are directories in the build dir under amber-files/repository/targets
-  _values $(cd ${fuchsia_build_dir}/amber-files/repository/targets && echo *(/))
+  _values $(cd ${fuchsia_build_dir}/amber-files/repository/targets >/dev/null 2>&1 && echo *(/))
 }
 
 __fx_build_dir() {
   # build dirs are directories under out/ with an args.gn
-  compadd $(cd ${fuchsia_dir}; echo out/*/args.gn(N:h))
+  compadd $(cd ${fuchsia_dir} >/dev/null 2>&1; echo out/*/args.gn(N:h))
 }
 
 __fx_gn_target() {
diff --git a/zsh-completion/_fx_set b/zsh-completion/_fx_set
index 8abdf45..ac0ea1b 100644
--- a/zsh-completion/_fx_set
+++ b/zsh-completion/_fx_set
@@ -1,28 +1,28 @@
 # _fx_set__board completes a board name
 _fx_set__board() {
-  compadd ${(u)$(cd ${fuchsia_dir};echo */boards/*.gni(N:t:r) vendor/*/boards/*.gni(N:t:r))}
+  compadd ${(u)$(cd ${fuchsia_dir} >/dev/null 2>&1;echo */boards/*.gni(N:t:r) vendor/*/boards/*.gni(N:t:r))}
 }
 
 # _fx_set__product completes a product name
 _fx_set__product() {
-  compadd ${(u)$(cd ${fuchsia_dir};echo */products/*.gni(N:t:r) vendor/*/products/*.gni(N:t:r))}
+  compadd ${(u)$(cd ${fuchsia_dir} >/dev/null 2>&1;echo */products/*.gni(N:t:r) vendor/*/products/*.gni(N:t:r))}
 }
 
 # _fx_set__package completes a package name
 _fx_set__package() {
-  compadd $(cd ${fuchsia_dir} && echo */packages/**/^*.*(.N) vendor/*/packages/**/^*.*(.N))
+  compadd $(cd ${fuchsia_dir} >/dev/null 2>&1 && echo */packages/**/^*.*(.N) vendor/*/packages/**/^*.*(.N))
 }
 
 # _packages completes a comma separated list of packages
 _packages() {
   # packages are files without extensions in */packages/ and vendor/*/packages/
-  _values -s , $(cd ${fuchsia_dir} && echo */packages/**/^*.*(.N) vendor/*/packages/**/^*.*(.N))
+  _values -s , $(cd ${fuchsia_dir} >/dev/null 2>&1 && echo */packages/**/^*.*(.N) vendor/*/packages/**/^*.*(.N))
 }
 
 # _products completes a comma separated list of products
 _products() {
   # products are .gni files in */products/ and vendor/*/products/
-  _values -s , $(cd ${fuchsia_dir} && echo */products/**/*.gni(.N) vendor/*/products/**/*.gni(.N))
+  _values -s , $(cd ${fuchsia_dir} >/dev/null 2>&1 && echo */products/**/*.gni(.N) vendor/*/products/**/*.gni(.N))
 }
 
 _gn_args_caching_policy() {
diff --git a/zsh-completion/_fx_verify-build-packages b/zsh-completion/_fx_verify-build-packages
index 10231d7..fb61e2f 100644
--- a/zsh-completion/_fx_verify-build-packages
+++ b/zsh-completion/_fx_verify-build-packages
@@ -1,5 +1,5 @@
 if (( $CURRENT == 2 )); then
-  local vendors=$(cd ${FUCHSIA_DIR}; ls -1d vendor/*(/N) | grep -v third_party)
+  local vendors=$(cd ${FUCHSIA_DIR} >/dev/null 2>&1; ls -1d vendor/*(/N) | grep -v third_party)
   compadd garnet peridot topaz $vendors
 fi