Dependency of nutch script on the type of shell

Previous Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Dependency of nutch script on the type of shell

praveen pathiyil
Hi,

I had a problem running the nutch script in 'sh', due to the 'unset
IFS' command. So I changed it to bash and it used to work properly.
Due to pure coincidence I was always running it from within the bin
directory and it used to work fine. Today I ran it as bin/nutch and it
gave an error. Finally the error was tracked down to a strange
behavior of bash for 'cd' command.

if you do
# cd ./..
the shell silently takes you to the parent directory. But if you do
# cd <some dir>/..
then the shell prints out the current directory and then takes you to
the parent dir.

Due to this, when the following command was executed, NUTCH_HOME was
set to a string which was the current directory given 2 times with a
space between them, thus making it an erroneous entry for the
CLASSPATH.

NUTCH_HOME=`cd "$THIS_DIR/.." ; pwd`

So I guess this should ideally be changed to NUTCH_HOME=`cd
"$THIS_DIR/.." > /dev/null; pwd`

[ Thanks to my friend Carlos Ugarte for debugging this with me ]

Regards,
Praveen.