First open the .bashrc
then if you have the password in an environment variable, example SUDO_PASSWORD
sudo $SUDO_PASSWORD | sudo -S command
without environment variable:
sudo "your_password" | sudo -S command
If you don’t want to restart your computer, run this command:
source ~/.bashrc