Use a sed delimiter that is unlikely to appear in the input (#1184)
This commit is contained in:
parent
86936d7b5b
commit
99d018f059
|
@ -83,7 +83,7 @@ if [ -d "$1" ]; then
|
||||||
for file in ${files[@]+"${files[@]}"}; do
|
for file in ${files[@]+"${files[@]}"}; do
|
||||||
local backup=$(mktemp)
|
local backup=$(mktemp)
|
||||||
touch -r "${file}" "${backup}"
|
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
|
if [[ "$?" -ne "0" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -74,7 +74,7 @@ if [ -d "$1" ]; then
|
||||||
for file in ${files[@]+"${files[@]}"}; do
|
for file in ${files[@]+"${files[@]}"}; do
|
||||||
local backup=$(mktemp)
|
local backup=$(mktemp)
|
||||||
touch -r "${file}" "${backup}"
|
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
|
if [[ "$?" -ne "0" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -74,7 +74,7 @@ if [ -d "$1" ]; then
|
||||||
for file in ${files[@]+"${files[@]}"}; do
|
for file in ${files[@]+"${files[@]}"}; do
|
||||||
local backup=$(mktemp)
|
local backup=$(mktemp)
|
||||||
touch -r "${file}" "${backup}"
|
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
|
if [[ "$?" -ne "0" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -78,7 +78,7 @@ if [ -d "$1" ]; then
|
||||||
for file in ${files[@]+"${files[@]}"}; do
|
for file in ${files[@]+"${files[@]}"}; do
|
||||||
local backup=$(mktemp)
|
local backup=$(mktemp)
|
||||||
touch -r "${file}" "${backup}"
|
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
|
if [[ "$?" -ne "0" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue