From be0f461304f9d6af6c449624a94838a4c42e5f31 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:05:37 +0200 Subject: [PATCH] cd_write --- cd.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cd.sh b/cd.sh index a59aa80..7c6b261 100644 --- a/cd.sh +++ b/cd.sh @@ -713,13 +713,14 @@ ${CD___UP}" } cd_write () { -local file="${1}" -local text="${2}" - if [ "${file}" ] ; then - [ -f "${file}" ] && cd_cat "${file}" - echo "→ ${1}" - printf "%s" "${text}" > "${file}" || exit - cd_cat "${file}" + cd_write__file="${1}" + cd_write__text="${2}" + # + if [ "${cd_write__file}" ] ; then + [ -f "${cd_write__file}" ] && cd_cat "${cd_write__file}" + echo "→ ${cd_write__file}" + printf "%s" "${cd_write__text}" > "${cd_write__file}" || exit + cd_cat "${cd_write__file}" fi }