From 6f3c5a814343372e318157dc288fe14f7a39e8b8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 31 Aug 2024 01:12:11 +0200 Subject: [PATCH] os/sed --- spcd/bootstrap.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 8133189..6764c83 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -260,13 +260,14 @@ spcd_os_rm() { } spcd_os_sed() { - spcd_os_sed__file="${1}" + local file="${1}" shift - if [ -f "${spcd_os_sed__file}" ]; then - _spcd_os_cat "${spcd_os_sed__file}" - for spcd_os_sed__regex in "${@}"; do - sed --in-place "s${spcd_os_sed__regex}g" "${spcd_os_sed__file}" && - _spcd_os_cat "${spcd_os_sed__file}" + if [ -f "${file}" ]; then + local regex + _spcd_os_cat "${file}" + for regex in "${@}"; do + sed --in-place "s${regex}g" "${file}" && + _spcd_os_cat "${file}" done fi }