Can I create my own bashrc file, something like “.xyzrc” and then import it from .bashrc?

StackOverflow https://stackoverflow.com/questions/7464677

  •  22-01-2021
  •  | 
  •  

Question

I want to put my dot files on GitHub , but I don't want all my aliases showing up publicly. So my plan is to put my aliases in a seperate file and .gitignore it. However I get a permission denied when I attempt to source that file. Are bashfiles supposed to be either .bashrc or .bash_profile?

(Mac OS X 10.7, Bash version 3.2.48(1)-release (x86_64-apple-darwin11).)

Was it helpful?

Solution

Of course this is possible, and also a very good practice. However, as per your message of denied permission, maybe you're trying to execute that files. But to correctly read those files at configuration time, you have to add either:

source ~/.yourfile

or

. ~/.yourfile

in your .bashrc file. (Note the space after the first dot, that is an alias for source).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top