`sed -i $SEARCH $FILE` doesn't work on macOS without an extension after `-i`
Closed this issue · 1 comments
avioli commented
Line 131 in 380eb0a
Based on Sinetris at Stack Overflow this patch (on top of 380eb0a) should fix the issue:
From 83bcbb1c39e59d86c83614b4328ed358fc382349 Mon Sep 17 00:00:00 2001
From: Evo Stamatov <aviolito@gmail.com>
Date: Fri, 13 Jul 2018 11:22:01 +1000
Subject: [PATCH] fix sed in-place replacemenet on macOS
---
git-issue.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-issue.sh b/git-issue.sh
index 33302d3..d16eb9b 100755
--- a/git-issue.sh
+++ b/git-issue.sh
@@ -128,7 +128,8 @@ edit()
cp "$file" "$file.new"
echo "Opening editor..."
${VISUAL:-vi} "$file.new" || return 1
- sed -i '/^#/d' "$file.new"
+ sed -i '.original' '/^#/d' "$file.new"
+ rm -f "$file.new.original"
if [ $(grep -c . "$file.new") -eq 0 ] ; then
echo 'Empty file' 1>&2
rm -f "$file.new"
--
2.17.1
To apply - save above as a file (ex. 0001-fix-sed-in-place-replacemnet-on-macOS.patch
):
git apply --check 0001-fix-sed-in-place-replacemnet-on-macOS.patch && \
git am --signoff < 0001-fix-sed-in-place-replacemnet-on-macOS.patch
Sorry... I don't have time for forks and pull requests.
dspinellis commented
Thank you!