From 7cd02781f8df8af55dc0e7c6127f624c3ea34373 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Thu, 7 Oct 2021 22:43:48 -0700 Subject: [PATCH] lib/utilities: `_bash-it-component-help()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need to `rm` when we overwrite the file the line after next. Alsö, use `>|` in case the user sets `noclobber`; we do expressly intend to overwrite the file in this case. --- lib/utilities.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/utilities.bash b/lib/utilities.bash index 9b011910..a6701fff 100644 --- a/lib/utilities.bash +++ b/lib/utilities.bash @@ -75,9 +75,8 @@ function _bash-it-component-help() { component="$(_bash-it-pluralize-component "${1}")" file="$(_bash-it-component-cache-file "${component}")" if [[ ! -s "${file}" || -z "$(find "${file}" -mmin -300)" ]]; then - rm -f "${file}" 2> /dev/null func="_bash-it-${component}" - "${func}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E ' \[' > "${file}" + "${func}" | ${BASH_IT_GREP:-$(_bash-it-grep)} -E ' \[' >| "${file}" fi cat "${file}" }