How to set zsh as default shell?

Hi,
I have added this in my postBuild file

# Install Zsh and Oh My Zsh
apt-get update && apt-get install --yes zsh

# Install Oh My Zsh silently
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

# Optional: install plugins for Oh My Zsh
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# Enable plugins in the .zshrc file
sed -i 's/plugins=(git)/plugins=(git zsh-syntax-highlighting zsh-autosuggestions)/' ~/.zshrc

How to set zsh as default shell, without running zsh in the default terminal?

Thank you

What have you tried so far? Can you share a link to your repository? postBuild runs as an unprivileged user, so this script won’t have installed zsh.

I have no problem, the postbuild install it and I run zsh and I have it.

I wanted to know if there was a way to apply it without writing it down.

The repo is this GitHub - aborruso/my-binder

Thank you

Sorry, I don’t understand what you mean by “without writing it down”.

Note it’s best practice to include set -e at the start of your script file, otherwise any errors whilst running the script will be silently ignored.

1 Like

Yes thank you, I will add -e.

But I think I do not have any error. My question is: I don’t have to add anything to say that zsh should be the default one?

Thank you

And I confirm that it works without any error.

But I wanted to know if there was a way to make it the default one.

1 Like

Try chsh -s /path/to/zsh
https://linux.die.net/man/1/chsh

1 Like

It gives me 1 error.

It probably cannot be done, I give up. I will write zsh myself in the termnal.