.profile: Add replace function

This commit is contained in:
Salt 2020-08-02 19:56:10 -05:00
parent 97df9ababf
commit 03b5f2a289

View File

@ -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)