Very nice explanation, David. Jan
> Let's look at the scripts step by step: > > > if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then > > if [ -f "/etc/ant.conf" ] ; then > > . /etc/ant.conf > > fi > > fi > > The outer if/then statement says if ANT_HOME isn't defined, or it is > defined as /usr/share/ant, then you check to see if the file > /etc/ant.conf exists. If it does, you execute it in the current > environment. This file should set some environment variables -- maybe > even the $ANT_HOME environment variable. This is the system wide > ant.conf file. You could set JAVA_HOME, ANT_HOME, whether to use the > jikes compiler, etc. And, these would apply to anyone who uses that > computer and doesn't have their own ANT installation. > > > > > # load user ant configuration > > if [ -f "$HOME/.ant/ant.conf" ] ; then > > . $HOME/.ant/ant.conf > > fi > > if [ -f "$HOME/.antrc" ] ; then > > . "$HOME/.antrc" > > fi > > The first if/ten statement looks to see if a file called > $HOME/.ant/ant.conf exists. If it does, it executes it in the current > environment. Again, this file probably just sets some environment > variables including JAVA_HOME and ANT_HOME. > > The second if/then statement does the same thing for $HOME/.antrc. > > Files that begin with a dot are normally invisible to the user. It is > common practice to have either a .xxxrc file to set parameters or to > have a .xxx directory that contains a *.conf file that sets > parameters. Ant does it both ways for no good reason. What about the reason which excuses all? For "Historical reasons" ;-) > > Do I have to use both Set and Export for ANT_HOME, do you think? > > Exporting an environment variable makes it available in all child > processes. Otherwise, it is only available in the current process. If > you define ANT_HOME in your .antrc file, you don't have to export it > since the shell script doesn't spawn another process. If you define it > before you run this script, you do have to export it or the script > won't see it. If you spawn a process from inside Java with <java fork|spawn>. What having the export have any impact? > BTW, notice that the ant script sets > > JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home > > if you don't have JAVA_HOME defined before your execute the "ant" > script on a Mac. > > David Weintraub --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
