Can not call defined funtions from .bashrc

I have a function in .bashrc like this:

function gs () {
  cmm="$1"
  if test -z "$cmm"
  then
    cmm="This is Manh Cuong's commit 🌻."
  fi
  
  git add . && git commit -m "$cmm" && git push
}

It worked well with gs and gs "new commit" commands in terminal. But I have just installed zsh, oh-my-zsh on my Ubuntu 20.04 Asus laptop. Then I call gs or gs "new commit", it does not work anymore. I do not know how to fix it. Could anybody help me. Thank you very much.


Solution 1:

If you're running zsh shell then you have to put this in ~/.zshrc instead of ~/.bashrc.

Once you've added it there, you can either open a new terminal or run source ~/.zshrc to use it.