summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xset-pwd.sh7
-rwxr-xr-xstart1
2 files changed, 5 insertions, 3 deletions
diff --git a/set-pwd.sh b/set-pwd.sh
index c6963f5..1ed18c2 100755
--- a/set-pwd.sh
+++ b/set-pwd.sh
@@ -1,9 +1,10 @@
#!/bin/sh
files="api/change-order.php api/export.php api/add.php api/remove.php src/data.php"
-[ -z "$1" ] && echo "\$1 has to be directory where project lives" && exit 1
-path="$(readlink -e "$1")"
+[ -z "$1" ] && cwd="." || cwd="$1"
+
+path="$(readlink -e "$cwd")"
for file in $files; do
- sed -i "s;%PWD%;$1/;" "$file"
+ sed -i "s;%PWD%;$path/;" "$file"
done
diff --git a/start b/start
index c3a84e0..8e63dcd 100755
--- a/start
+++ b/start
@@ -1,2 +1,3 @@
#!/bin/sh
+./set-pwd.sh
php -S 0.0.0.0:8000