Shell code cleanup

- Argument mixes string and array. Use * or separate argument.
- Quote the grep pattern so the shell won't interpret it.
- Use "${var:?}" to ensure this never expands to /* .
- > is for string comparisons. Use -gt instead.
- Quote the parameter to -name so the shell won't interpret it.

Closes #4163.

PiperOrigin-RevId: 179042046
diff --git a/scripts/serve-docs.sh b/scripts/serve-docs.sh
index f1dfbd5..c4541a8 100755
--- a/scripts/serve-docs.sh
+++ b/scripts/serve-docs.sh
@@ -41,7 +41,7 @@
 
 build_tree() {
   bazel build //site:jekyll-tree.tar
-  rm -rf $WORKING_DIR/*
+  rm -rf ${WORKING_DIR:-sentinel}/*
   tar -xf "$(bazel info bazel-genfiles)/site/jekyll-tree.tar" -C $WORKING_DIR
 }