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
3434# Copy original recipe to new recipe directory
3535cp -r recipes/$orig recipes/$1
3636
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
3941
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.
4054
4155# ====== Additional instructions =======
4256
43- # Disable echo of all following script commands
44- set +x
45-
57+ echo # linebreak
4658echo --- Some helpful development commands for this recipe: ---
4759
4860# Basic node
You can’t perform that action at this time.
0 commit comments