CentOS 7 Does Not Switch Boot Shell Settings

Asked 2 years ago, Updated 2 years ago, 79 views

·What do you want to do
I installed zsh on CentOS 7 on vagrant with reference to https://qiita.com/d-dai/items/084cace7f6bfd3580f9d.And I confirmed that the path of zsh (/usr/local/bin/zsh) can be run directly.
I want to switch the default boot shell from bash to zsh.

·Problems
To change the boot shell, use the

#echo/usr/local/bin/zsh>>/etc/shells
# chsh-s/usr/local/bin/zsh

I ran , but then exec$SHELL-l did not start zsh and bash started.
The result of echo$SHELL remained /bin/bash.
How can I switch the boot shell successfully?

add
It was resolved by logging in again with vagrant ssh after exiting once.
Thank you for your reply.

linux centos

2022-09-30 21:40

1 Answers

You cannot rewrite environment variables (such as $SHELL) for another process from one process (such as $SHELL), so you can rewrite the file or run commands such as chsh(1) to keep the existing login shell process $SHELL.If you want to switch interaction shells without logging out, do export SHELL=/usr/local/bin/zsh and then exec $SHELL-l or exec env SHELL=/usr/local/bin/zsh/usr/local/bin/zsh-l.


2022-09-30 21:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.