shopt command not found in .bashrc after shell updation
Solution 1:
zsh uses env profile ~/.zshrc
, not ~/.bashrc
.
so you need to append your env settings to .zshrc
file and then
source ~/.zshrc
It must work.
rbenv github link
Solution 2:
To place anything in ~/.bashrc:
Switch to bash:
exec bash
Then
source ~/.bashrc
Switching to bash will not effect on new terminal window. But if you want to switch current window to zsh.
Switch to zsh:
exec zsh
reference
Solution 3:
shopt
is not a command, but a shell built-in. bash
knows what to do with it because it's a bash
built-in , but zsh has no idea what it is. You'll want to look into setopt
which is a zsh
built-in, and put those values into a new .zshrc script.
Solution 4:
Make an alias of shopt and call it through zsh
A quick solution is described here: https://github.com/larz258/Zshopt
sudo vi /usr/bin/shopt
Inside the shopt
#!/bin/bash
args='';
for item in $@
do
args="$args $item";
done
shopt $args;
make it executable
sudo chmod +x /usr/bin/shopt
Create an alias in your .zshrc
echo "alias shopt='/usr/bin/shopt'" >> ~/.zshrc
Solution 5:
Your bashrc
file was written for bash
. zsh
is not bash
.
I'm surprised zsh
is trying to load your .bashrc
at all.
If it isn't and you are sourcing it manually (from .profile
or similar). Stop doing that.
Then you get to write an appropriate zsh
init file instead.
If you want to use zsh
then you need to use zsh
and not bash
.
shopt
is a bash-ism.
[[
is a bash-ism.