[NCLUG] /etc/environment

Bob Proulx bob at proulx.com
Sun Aug 19 14:16:13 MDT 2007


John L. Bass wrote:
> Bob Proulx writes:
> >   #!/bin/sh
> >   export DEVELOPMENT_HOME=/usr/local/development
> >   export JAVA_PROJECT_HOME=$DEVELOPMENT_HOME/Java/projects
> >   exec myjavaprogram "$@"
> 
> I have a fair number of those kind of scripts on a few systems, and in
> retrospect, it's a hell of a lot of editing when something needs to
> change.
> 
> Have a single point of change, is by far better.

In that case then this:

File /usr/local/etc/default/myjavadefaults:

  export DEVELOPMENT_HOME=/usr/local/development
  export JAVA_PROJECT_HOME=$DEVELOPMENT_HOME/Java/projects

File /usr/local/bin/myjavaprogram1:

  #!/bin/sh
  . /usr/local/etc/default/myjavadefaults
  exec myjavaprogram1.java "$@"

File /usr/local/bin/myjavaprogram2:

  #!/bin/sh
  . /usr/local/etc/default/myjavadefaults
  exec myjavaprogram2.java "$@"

That would provide a single place to edit and make changes that
mimicks the current system best practice of /etc/default/PACKAGE.

Bob



More information about the NCLUG mailing list