diff --git a/bin/replace b/bin/replace index 8c2a906d..5c1b8de7 100755 --- a/bin/replace +++ b/bin/replace @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # # Find and replace by a given list of files. # @@ -8,7 +8,6 @@ find_this="$1"; shift replace_with="$1"; shift items=( $(ag -l --nocolor "$find_this" "$@") ) -temp="${TMPDIR:-/tmp}/replace_tmp.$$" for item in ${items[@]}; do - sed "s/$find_this/$replace_with/g" "$item" > "$temp" && mv "$temp" "$item" + sed -i "s/${find_this}/${replace_with}/g" "$item" done