Use a sed delimiter that is unlikely to appear in the input (#1184)

This commit is contained in:
Michael Kaufmann 2024-03-22 22:36:00 +01:00 committed by GitHub
parent 86936d7b5b
commit 99d018f059
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ if [ -d "$1" ]; then
for file in ${files[@]+"${files[@]}"}; do
local backup=$(mktemp)
touch -r "${file}" "${backup}"
/usr/bin/sed -i '' -e 's@'"$2"'@'"$3"'@g' "${file}"
/usr/bin/sed -i '' -e 's'$'\001'"$2"$'\001'"$3"$'\001''g' "${file}"
if [[ "$?" -ne "0" ]]; then
exit 1
fi

View File

@ -74,7 +74,7 @@ if [ -d "$1" ]; then
for file in ${files[@]+"${files[@]}"}; do
local backup=$(mktemp)
touch -r "${file}" "${backup}"
sed -i 's@'"$2"'@'"$3"'@g' "${file}"
sed -i 's'$'\001'"$2"$'\001'"$3"$'\001''g' "${file}"
if [[ "$?" -ne "0" ]]; then
exit 1
fi

View File

@ -74,7 +74,7 @@ if [ -d "$1" ]; then
for file in ${files[@]+"${files[@]}"}; do
local backup=$(mktemp)
touch -r "${file}" "${backup}"
/usr/bin/sed -i '' -e 's@'"$2"'@'"$3"'@g' "${file}"
/usr/bin/sed -i '' -e 's'$'\001'"$2"$'\001'"$3"$'\001''g' "${file}"
if [[ "$?" -ne "0" ]]; then
exit 1
fi

View File

@ -78,7 +78,7 @@ if [ -d "$1" ]; then
for file in ${files[@]+"${files[@]}"}; do
local backup=$(mktemp)
touch -r "${file}" "${backup}"
sed -i 's@'"${argv2}"'@'"${argv3}"'@g' "${file}"
sed -i 's'$'\001'"${argv2}"$'\001'"${argv3}"$'\001''g' "${file}"
if [[ "$?" -ne "0" ]]; then
exit 1
fi