3 ms·
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 rew
by xkgt 8y ago
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?
- mixmastamyk 8y agoYou don’t. ;-) Use fish/zsh interactively, sh for simple scripts, Python for the more complex.
- xkgt 8y agoYeah 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.
- pseudalopex 8y agoMost scripts are run, not sourced. Some tools support fish. bass[1] aims to handle the rest. [1] https://github.com/edc/bass https://github.com/edc/bass
- TheAceOfHearts 8y agoCould you give a concrete example of a situation you have in mind? If I'm understanding you correctly, then one solution could be to create a small wrapper to exec bash, source your environment-modifying script, and then exec fish. Are you familiar with exec [0]? fish also has an exec command [1]. I've been using fish for years and it hasn't been an issue. You can keep bash installed for any hardcore scripting, and just fish as your interactive shell. [0] https://stackoverflow.com/a/38581329 https://stackoverflow.com/a/38581329 [1] https://fishshell.com/docs/current/commands.html#exec https://fishshell.com/docs/current/commands.html#exec