Skip to content

Commit 0c91000

Browse files
Make clean-tutorial.sh executable from any directory (#716)
1 parent 4a41f11 commit 0c91000

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

changelog-entries/716.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Allow running tutorial cleaning scripts (`clean-tutorial.sh`, `clean-all.sh`) from the repository root by resolving paths relative to the script location.
2+

clean-all.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/env sh
22
set -e -u
33

4+
# Always operate relative to the directory of this script
5+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
6+
cd "$SCRIPT_DIR"
7+
48
echo "Cleaning up all tutorials..."
59

610
find . -maxdepth 2 -mindepth 2 -name clean-tutorial.sh -execdir sh -c './clean-tutorial.sh' \;

tools/clean-tutorial-base.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/env sh
22
set -e -u
33

4+
# Determine the tutorial directory (where the symlink is located)
5+
TUTORIAL_DIR="$(cd "$(dirname "$0")" && pwd)"
6+
cd "$TUTORIAL_DIR"
7+
48
# shellcheck disable=SC1091
59
. ../tools/cleaning-tools.sh
610

0 commit comments

Comments
 (0)