After upgrading to a new machine and Ventura it no longer worked, stating it needed at least bash 4.0. So, I installed bash via homebrew and at least from within the terminal I can use the script and it works fine.
Making it work with the "Execute Shell Script" action is another deal, though. I read the wiki as well as the corresponding posts, but I seem to miss something. Whatever I do, it doesn't help. Any ideas where I need to look more or where the issue might be is greatly appreciated.
Some context information
Executing #!/bin/sh echo "$SHELL" always returns "/bin/zsh". No matter if I set the variable "ENV_PATH" or not. I tried setting it to "/opt/homebrew/bin/bash". At this point, if I try to run the script the KM notification says:"bash command not found".
In the terminal bash --version brings me GNU bash, version 5.2.15(1)-release (aarch64-apple-darwin22.1.0) and the script itself works fine.
If, back in KM, I empty the ENV_Path and add #!/bin/bash the notification gives me the compatibility issue due to bash being outdated. If I add back the correct path, I get the command bash not found information.
I feel a bit confused and don't really know where to look next. Any ideas?
...while the first line of ~/Dekstop/ots.bash should be changed to
...so the interpreter uses the right version.
(At the moment you're saying "Hey, KM! Use bash v5 to change directory and run this script". bash5 opens the file, reads the first (shebang) line and is told that the following script should be interpreted by your default bash v3. Since I'm working blind I'm suggesting to explicitly run this script with v5 rather than changing things so all KM bash scripts use v5, because who knows what that might break!)
My worry is always that changing the default bash might break other things that don't want v5... Only OP knows which will be more painful -- individually setting those things that need v5 or individually setting those things that need v3.
(Yes, I've seen a self-proclaimed Bioinformatics guru fubar his own project pipeline doing this. Had a hard time getting out of the room before bursting into laughter )
Thank you very much @Nige_S and @ccstone - both of your replies helped me solve the problem.
The hint changing the shebang within the script totally made sense once I read it. Before that, it didn't really cross my mind. Once I did that I got a dependency error which was kind of weird because I did install it. This is where the macro posted by @ccstone really helped me set the ENV_PATH variable correctly.
After combining both, the script finally works. Yay!
Thanks again, guys. I greatly appreciate your help!
EDIT: @ccstone Within your macro I had to replace the first menu action with "Settings" because I got a small notice saying the menu item "Preferences" couldn't be found.