How do people manage scripts to be used in such niche shells? I started using zsh at work recently, while I quite enjoy the shell experience it is a pain to rewrite all bash scripts to zsh or add lines of codes for compatibility. Any pointers?
You don’t. ;-) Use fish/zsh interactively, sh for simple scripts, Python for the more complex.
Yeah I get that. But this method doesn't help for scripts that need to modify the current session state (such as export session variables). I am guessing here that such scripts are an edge case and most shell scripts can be simply executed with sh.
Most scripts are run, not sourced. Some tools support fish. bass[1] aims to handle the rest.