diff --git a/autotools/build-bash-completion b/autotools/build-bash-completion index 57729dd68a62f38f5f48cce4c033e03bc0ff65c7..f49f9ade7e9d625b3fbab9a43560c84b785b2e5d 100755 --- a/autotools/build-bash-completion +++ b/autotools/build-bash-completion @@ -85,7 +85,7 @@ def WritePreamble(sw): sw.IncIndent() try: node_list_path = os.path.join(constants.DATA_DIR, "ssconf_node_list") - sw.Write("cat %s", utils.ShellQuote(node_list_path)) + sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(node_list_path)) finally: sw.DecIndent() sw.Write("}") @@ -95,7 +95,7 @@ def WritePreamble(sw): try: instance_list_path = os.path.join(constants.DATA_DIR, "ssconf_instance_list") - sw.Write("cat %s", utils.ShellQuote(instance_list_path)) + sw.Write("cat %s 2>/dev/null || :", utils.ShellQuote(instance_list_path)) finally: sw.DecIndent() sw.Write("}") @@ -104,9 +104,10 @@ def WritePreamble(sw): sw.IncIndent() try: # FIXME: this is really going into the internals of the job queue - sw.Write("local jlist=$( cd %s && echo job-*; )", + sw.Write(("local jlist=$( shopt -s nullglob &&" + " cd %s 2>/dev/null && echo job-* || : )"), utils.ShellQuote(constants.QUEUE_DIR)) - sw.Write("echo ${jlist//job-/}") + sw.Write('echo "${jlist//job-/}"') finally: sw.DecIndent() sw.Write("}") @@ -116,7 +117,8 @@ def WritePreamble(sw): try: # FIXME: Make querying the master for all OSes cheap for path in constants.OS_SEARCH_PATH: - sw.Write("( cd %s && echo *; )", utils.ShellQuote(path)) + sw.Write("( shopt -s nullglob && cd %s 2>/dev/null && echo * || : )", + utils.ShellQuote(path)) finally: sw.DecIndent() sw.Write("}")