Skip to content

Commit faaac99

Browse files
authored
Avoid sed -i
It isn't cross-platform compatible without creating a back-up file. See https://stackoverflow.com/a/4247319/1924128 Fixes #24
1 parent 537c19c commit faaac99

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

bin/wpppb-init

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ fi
4040
if [[ ! -e tests/phpunit/includes/bootstrap.php ]]; then
4141

4242
echo Copying tests/phpunit/includes/bootstrap.php...
43-
cp "${scaffold_path}"/bootstrap.php tests/phpunit/includes/bootstrap.php
44-
4543
echo "Please enter the basename slug of your plugin (ex. my-plugin/my-plugin.php):"
4644
read plugin_name
4745

48-
sed -i '' "s|my-plugin/my-plugin.php|$plugin_name|" tests/phpunit/includes/bootstrap.php
46+
sed -e "s|my-plugin/my-plugin.php|$plugin_name|" "${scaffold_path}"/bootstrap.php \
47+
> tests/phpunit/includes/bootstrap.php
4948

5049
else
5150
echo Not copying tests/phpunit/includes/bootstrap.php, already exists...
@@ -54,12 +53,11 @@ fi
5453
if [[ ! -e tests/phpunit/test-uninstall.php ]]; then
5554

5655
echo Copying tests/phpunit/test-uninstall.php...
57-
cp "${scaffold_path}"/test-uninstall.php tests/phpunit/test-uninstall.php
58-
5956
echo "Please enter the prefix that your plugin uses in the database (ex. my_plugin):"
6057
read prefix
6158

62-
sed -i '' "s/myplugin/$prefix/" tests/phpunit/test-uninstall.php
59+
sed -e "s/myplugin/$prefix/" "${scaffold_path}"/test-uninstall.php \
60+
> tests/phpunit/test-uninstall.php
6361

6462
else
6563
echo Not copying tests/phpunit/test-uninstall.php, already exists...

0 commit comments

Comments
 (0)