Skip to content

Commit c9d579b

Browse files
authored
Refactor find command for better readability
1 parent 08a681b commit c9d579b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/replace_everywhere.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ main() {
108108
fi
109109

110110
# Execute replacement
111-
# Logic: find . \( PRUNES \) -o -type f -exec sed -i ... '{}' \;
112-
# Using a here-string to keep array expansions intact.
113111
if [[ ${#PRUNE_BLOCK[@]} -gt 0 ]]; then
114-
find . \( "${PRUNE_BLOCK[@]}" -false \) -o -type f -exec sed "${SED_INPLACE[@]}" "s/${search}/${replace}/g" {} +
115-
} else
116-
find . -type f -exec sed "${SED_INPLACE[@]}" "s/${search}/${replace}/g" {} +
112+
find . \( "${PRUNE_BLOCK[@]}" -false \) -o -type f \
113+
-exec sed "${SED_INPLACE[@]}" "s/${search}/${replace}/g" {} +
114+
else
115+
find . -type f \
116+
-exec sed "${SED_INPLACE[@]}" "s/${search}/${replace}/g" {} +
117117
fi
118118

119119
echo "Done."

0 commit comments

Comments
 (0)