I'm currently trying to configure a server using Precise Pangolin and Vagrant (a software allowing me to provision a number of software when booting my VM).

My current question is a pure bash one.

I've discovered that my .bashrc file is already filled with interesting commands. I want, in a way or another, to add this cool maven.bashrc colorizing to my bash. How can I do that without hand-editting my .bashrc ?

Notice I can (and in fact already have) write files into /etc/profile.d. is it recommended for that kind of stuff ?


You can do one of two things.

  1. Add the commands to the end of .bashrc.
  2. Create a new file (I create one in a folder ~/.bin, which is automatically added to your path when you login). Source the file at the end of your .bashrc. For example, if your file is called bashextras, add the line:
    . ${HOME}/bin/bashextras

/etc/profile and /etc/profile.d affect every user on the system, not just you. So, unless you specifically want every user to be affected, it is best to use only your own .bashrc (affects only your terminal sessions) or .profile (run at login and affects your entire session).

  • Yes but there is no way to "just drop" bash files at a convenient location ? – Riduidel Jan 25 '13 at 14:39
  • I'm sorry, I don't know what you mean. Are you asking where you can place scripts ("bash files") so that the system finds them? The folder ~/bin (that's bin within your home folder) is automatically added to your path. If the folder does not yet exist, create the folder, log out, and log in again. However, this is not what your original question asks. – Paddy Landau Jan 25 '13 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.