From 563713b4b8c5c362e6ea6309346d20cd24f51a9f Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 25 Oct 2023 21:17:52 -0400 Subject: [PATCH] Make bash script work when called in other dirs --- www/wip_new_website/build-dev-local.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/wip_new_website/build-dev-local.sh b/www/wip_new_website/build-dev-local.sh index a0e0c5a254..5c355fd5d0 100755 --- a/www/wip_new_website/build-dev-local.sh +++ b/www/wip_new_website/build-dev-local.sh @@ -4,6 +4,12 @@ # NOTE run `bash www/build.sh` to cache local copy of fonts, and repl assets etc +## Get the directory of the currently executing script +DIR="$(dirname "$0")" + +# Change to that directory +cd "$DIR" || exit + rm -rf dist/ cp -r ../build dist/ mkdir -p dist/wip