Skip to content

Make clean.sh scripts executable from any directory#751

Open
k4rtikx wants to merge 1 commit intoprecice:developfrom
k4rtikx:fix-clean-scripts-any-directory
Open

Make clean.sh scripts executable from any directory#751
k4rtikx wants to merge 1 commit intoprecice:developfrom
k4rtikx:fix-clean-scripts-any-directory

Conversation

@k4rtikx
Copy link

@k4rtikx k4rtikx commented Mar 9, 2026

Fix clean.sh scripts so they can be executed from any directory.

Many case-level clean.sh scripts source ../../tools/cleaning-tools.sh using
relative paths. When invoked from outside their directory (e.g.
./fluid-openfoam/clean.sh), the working directory differs and the relative
path breaks.

This PR ensures scripts always execute from their own directory by adding:

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"

Changes:

  • Added SCRIPT_DIR handling to 111 case-level clean.sh scripts
  • Updated partitioned-heat-conduction-direct/clean-tutorial.sh
    (the only non-symlink clean-tutorial.sh)
  • Added missing set -e -u to
    flow-around-controlled-moving-cylinder/solid-python/clean.sh
  • Left 34 symlinked clean-tutorial.sh files unchanged

Verification:

  • Spot-checked scripts across multiple tutorials
  • Tested running scripts from parent directories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant