From 1100cf423433f7e6a3a5c3bca7f579244c4b8118 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:32:21 +0200 Subject: [PATCH] cd_sed --- cd.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cd.sh b/cd.sh index ecb9f92..561dc0e 100644 --- a/cd.sh +++ b/cd.sh @@ -686,14 +686,14 @@ local path="${1}" } cd_sed () { -local expression -local file="${1}" -shift - if [ -f "${file}" ] ; then - cd_cat "${file}" - for expression in "${@}" ; do - sed --in-place "s${expression}g" "${file}" \ - && cd_cat "${file}" \ + cd_sed__file="${1}" + shift + # + if [ -f "${cd_sed__file}" ] ; then + cd_cat "${cd_sed__file}" + for cd_sed__regex in "${@}" ; do + sed --in-place "s${cd_sed__regex}g" "${cd_sed__file}" \ + && cd_cat "${cd_sed__file}" \ || exit done fi