Silently handle the case of no *.prompt files existing.
authorIain Patterson <me@iain.cx>
Tue, 20 Nov 2018 16:20:59 +0000 (16:20 +0000)
committerIain Patterson <me@iain.cx>
Sat, 8 May 2021 08:49:03 +0000 (10:49 +0200)
.profile.d/prompt.bashrc

index e67a8fd..8114b29 100644 (file)
@@ -10,4 +10,4 @@ if [ -n "$OLDSOLARIS" -a ! "${TERM##screen}" = "$TERM" ]; then
   unset _prompt_command_escape
 fi
 
-PROMPT_COMMAND='for snippet in ${PROFILE_HOME:-~}/.prompt.d/*.prompt; do . $snippet; done; unset snippet'
+PROMPT_COMMAND='shopt -q nullglob; ng=$?; shopt -s nullglob; for snippet in ${PROFILE_HOME:-~}/.prompt.d/*.prompt; do . $snippet; done; unset snippet; [ $ng = 0 ] || shopt -u nullglob; unset ng'