From 03b5f2a289ac93e213df4d540252d819849d05e4 Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 2 Aug 2020 19:56:10 -0500 Subject: [PATCH] .profile: Add replace function --- .profile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.profile b/.profile index 327b353e..587a639d 100755 --- a/.profile +++ b/.profile @@ -234,6 +234,15 @@ if has ptgdp; then echo "$*" | ptgdp -p } fi +if has sed && has find; then + replace() { + if [ $# -ne 2 ]; then + echo "replace: Requires two arguments" + return 1 + fi + find . -type f -exec sed -i "s/$1/$2/g" {} \; + } +fi if has sudo; then case $_baseshell in *bash|*zsh)