From ce872d4ecb48c80029b175d68ffd7991ed2f1187 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 1 Dec 2024 23:40:54 +0100 Subject: [PATCH] file/append,empty --- sh/util.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sh/util.sh b/sh/util.sh index 4dd81bf..cbcd67a 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -1,3 +1,18 @@ +rwx_file_append() { + local file="${1}" + local text="${2}" + if [ -n "${file}" ]; then + printf "%s" "${text}" >>"${file}" + fi +} + +rwx_file_empty() { + local file="${1}" + if [ -n "${file}" ]; then + rwx_file_write "${file}" "" + fi +} + rwx_file_write() { local file="${1}" local text="${2}"