1

I have a system wide install of a software . The source is located at /opt/Software . There is a bashrc file of the Software which is needed to be sourced for every user using it . Will the addition of


source $PATH_TO_SOFTWARE_BASHRC
to their ~/.bashrc work for all users ? How should I set the permissions for the file at $PATH_TO_SOFTWARE_BASHRC so that all the users can access the software ?
balkrishna
  • 31
  • 2

2 Answers2

5

Just put that code in /etc/bashrc and every user will have it.
If there will be some permission issues, use chown/chmod to fix that.

Andrejs Cainikovs
  • 1,621
  • 1
  • 14
  • 20
  • I find no reference to `/etc/bashrc` in the Bash documentation. – Dennis Williamson Jul 29 '10 at 14:33
  • There *is* the reference, check the `--rcfile` description. This filename may vary on various distributions. For Ubuntu it is `/etc/bash.bashrc`. – Andrejs Cainikovs Jul 29 '10 at 15:29
  • Actually, in the [original manual](http://tiswww.case.edu/php/chet/bash/bashref.html) there's only a reference to `/etc/profile`. So apparently any other files in `/etc` are installation dependent, but the original docs don't say anything about this either. – Dennis Williamson Jul 30 '10 at 09:14
0

Set the permissions of the file to be world readable:

chmod 644 /path/to/your/file

Some shells don't understand the source command, so to make it work more broadly use:

. /path/to/your/file

even though it appears that you may only be using Bash.

Put that in each users' ~/.bashrc or to make it simpler, put it in /etc/bash.bashrc so it's available to every user without having to maintain it in individual files.

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151