I have a .bashrc file on Mac OS in which I set some aliases. After I make it and I type source .bashrc, the aliases work perfectly. However if open another shell, my shortcut command will not be recognized and I need to do source .bashrc again. How can it make it once and for all?
source is a shell built-in command which is used to read and execute the content of a file(generally set of commands), passed as an argument in the current shell script. The command after taking the content of the specified files passes it to the TCL interpreter as a text script which then gets executed.
Source Command Syntax Where: [filename] : The name or path to the file you want the source command to execute. [arguments] : Any arguments you provide become positional parameters when the file is executed.
I encounter the same problem and I solve it.
The macos have shift the default shell from bash to zsh.
So I try to modify the ~/.bashrc and ~/.bash_profile and source that but just work to current Terminal.
The fact is you should modify the ~/.zshrc profile file.
Try it my friend!
If you are on Mac and you want to source ~/.bash_profile automatically on when a terminal is opened
source ~/.bash_profile in Run command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With