ColorEchoForShell
ColorEchoForShell copied to clipboard
fix(test-scripts/sh): use $0 instead of $_
User description
I stumbled accross this while working on #2 .
Fixes an error that occurs when running ./test-scripts/sh:
$ test-scripts/sh
dirname: invalid option -- 'e'
Try 'dirname --help' for more information.
test-scripts/sh: line 4: cd: null directory
After execution of line 3 set -e variable $_ gets overwritten with "set -e".
Line 4 tries to get the dirname for "set -e" and fails.
PR Type
Bug fix
Description
-
Fix shell script variable reference error
-
Replace
$_with$0for directory resolution
Diagram Walkthrough
flowchart LR
A["Script execution"] --> B["set -e command"]
B --> C["$_ gets overwritten"]
C --> D["dirname fails with 'invalid option -e'"]
E["Use $0 instead"] --> F["Correct directory resolution"]
File Walkthrough
| Relevant files | |||
|---|---|---|---|
| Bug fix |
|
Summary by CodeRabbit
- Refactor
- Reworked shell script path resolution to be more robust when invoked from different directories or shells, reducing environment-specific quirks.
- Tests
- Improved reliability of test scripts by ensuring dependencies are located and loaded correctly regardless of invocation path, helping prevent intermittent failures on CI and local setups. No changes to test coverage or outcomes.