I have some stuff I want to perform in .bashrc which I would prefer to exist in another file on the system. How can I include this file into .bashrc?
bashrc files or any files which has your environment variables or even other data which you want in them, for example you can have three . bashrc files at your home directory.
bashrc file is a script file that's executed when a user logs in. The file itself contains a series of configurations for the terminal session. This includes setting up or enabling: coloring, completion, shell history, command aliases, and more.
Download and source the OpenStack RC fileOn the Project tab, open the Compute tab and click Access & Security. On the API Access tab, click Download OpenStack RC File and save the file. The filename will be of the form PROJECT-openrc.sh where PROJECT is the name of the project for which you downloaded the file.
Add source /whatever/file
(or . /whatever/file
) into .bashrc
where you want the other file included.
To prevent errors you need to first check to make sure the file exists. Then source the file. Do something like this.
# include .bashrc if it exists if [ -f $HOME/.bashrc_aliases ]; then . $HOME/.bashrc_aliases fi
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