File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,27 @@ set -x
34
34
# Copy original recipe to new recipe directory
35
35
cp -r recipes/$orig recipes/$1
36
36
37
- # Replace all usages of the original recipe's name with the new recipe's name
38
- grep -rl $orig recipes/$1 | xargs sed -i " s/$orig /$1 /g"
37
+ # Disable echo of all following script commands.
38
+ # We used to be able to echo the substitution one-liner,
39
+ # but the portable version is now too verbose.
40
+ set +x
39
41
42
+ # Replace all usages of the original recipe's name with the new recipe's name
43
+ echo " + Substituting all occurrences of $orig in recipes/$1 "
44
+ for file in $( grep -rl $orig recipes/$1 )
45
+ do
46
+ sed " s/$orig /$1 /g" $file > $file .new
47
+ mv $file .new $file
48
+ done
49
+ # This used to be as simple as:
50
+ # grep -rl $orig recipes/$1 | xargs sed -i "s/$orig/$1/g"
51
+ # But there are portability issues with in-place substitution (-i)
52
+ # between the GNU (most linux distros) and BSD (mac osx) versions of `sed`.
53
+ # See https://stackoverflow.com/a/21243111 for details.
40
54
41
55
# ====== Additional instructions =======
42
56
43
- # Disable echo of all following script commands
44
- set +x
45
-
57
+ echo # linebreak
46
58
echo --- Some helpful development commands for this recipe: ---
47
59
48
60
# Basic node
You can’t perform that action at this time.
0 commit comments