1

I am trying to use zsh as the default shell on a system where bash as default shell. Since I don't have the root permission, I was trying to use bashrc to switch over shell to zsh at the time of login. I took input from Making zsh default shell without root access and here is my bashrc content relevant to zsh:-

if [ -e $(which zsh) ]; then
    export SHELL=$(which zsh)
    exec $(which zsh) -l
fi

The issue I am encountering is when I boot/reboot the system, it comes up to the login screen but does not reach the Desktop even after providing the correct password. In fact, my system is already configured to directly login to the Desktop without a password.

I have done lot of search on various forums but no one has raised this issue.

My OS is Redhat 8.7 and Alma Linux 8.7 and in both cases, the issue appears the same. Desktop environment is GNOM.

  • My guess is that there is a BASH profile to set up variables, but none for zsh. Maybe also add an echo "$@" to the beginning of the script. Probably bash gets the floag for a login shell, but you don't pass it on to zsh. – U. Windl Dec 01 '22 at 14:56
  • what does "$@" mean? When I try it in the terminal, it returns nothing. – sundar_ima Dec 01 '22 at 16:10
  • See PARAMETERS in the BASH manual page, or write a script using echo "$@" and run it with a few parameters. When trying to replace the shell, I'm assuming you have some basic understanding how each shell works. – U. Windl Dec 02 '22 at 07:38
  • Read the doc. Your suggestion does not work. – sundar_ima Dec 11 '22 at 12:10
  • Maybe elaborate on "does not work" and be a bit more specific on what docs to read, specifically what part of such doc. Still the semantics of echo "$@" is well-defined. – U. Windl Dec 12 '22 at 07:15
  • Also: Doesn't you code create a syntax error if no zsh is found? Maybe see https://mywiki.wooledge.org/BashPitfalls – U. Windl Dec 12 '22 at 07:19

0 Answers0