Scripts - Compatibility with Catalina and Big Sur

joethedsa
Contributor II

Let me first say I am still new to scripting! As we know, ever since Catalina, the default shell is now zsh which is now posing problems since most of my scripts are bash (they start with #!/bin/bash). I'm noticing more and more of the scripts that I have are now not working in Catalina and inevitably won't work in Big Sur when it's available. To start in small troubleshooting steps, I found that just putting "#!/bin/zsh" at the beginning of the script doesn't solve the issues I'm having. A lot of the scripts that I have are doing curl commands to leverage the API to update Extension Attributes. A lot of SmartGroup criteria are using those EAs for membership and then I have policies that are scoped to those SmartGroups. If changes aren't being updated via the API, you can see how things spiral out of control.

I know there is no blanket solution, but does anyone have any suggestions or would like to share things they've done to get existing scripts to work on Catalina?

1 REPLY 1

mschroder
Valued Contributor

bash is still available on Big Sur, and I don't think it will go away in the near future. As long as your bash scripts use "#!/bin/bash" you are fine, since they will continue to run in bash, no matter what the default user shell is or will be. You should NOT replace this with "#!/bin/zsh" without making sure they are converted to zsh syntax and commands. So the just make sure you use "#!/bin/bash" in all your bash scripts.