Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> pig shell script does not check for PIG_HOME being set prior to exporting


Copy link to this message
-
pig shell script does not check for PIG_HOME being set prior to exporting
It looks like the pig shell script in v0.11 exports PIG_HOME without first checking to see if it already exists.

from line 78 in <path>/bin/pig:
# the root of the Pig installation
export PIG_HOME=`dirname "$this"`/..

Going through the script it appears most env variables are checked prior to setting, but not this one.  Is there a reason why?

Background: I ask this because I was getting an error resolving the path to pig.jar.  From what I gather it is because I use a symbolic link in /usr/local/bin to the pig script instead of modifying my PATH.  This meant `$this` in the bash script returned the path to /usr/local/bin instead of /usr/local/pig-0.11.0/bin.

I modified my local version to the following:

# the root of the Pig installation
if [ -z "$PIG_HOME" ]; then
    export PIG_HOME=`dirname "$this"`/..
fi

Is this something the script should have in it, or am I operating outside of the expected scenario?

Thanks,
Robert