Whoa yeah, nice catch indeed; I would never have thought of that.

It turns out that's not the issue at all, but that suggestion pointed me in
the right direction.

A few things to note here...
Thing 1: 'which cd' doesn't help because cd is a builtin, and so you get the
"which: no cd in (..." result.
Thing 2: Because I typically don't use '-x' in my alias commands, the hadoop
script doesn't inherit my shell aliases.  I verified this by adding an
'alias -p' to the hadoop script, and the script has no aliases for anything.

Thing 3: If the CDPATH environment variable exists, and the path is
ambiguous, the cd command is *not* silent, aliased or not.  It will print
the dir it chose to cd to.  In my case, there were 2 'bin' possibilities in
my CDPATH.

So I'm going to unset my CDPATH, since I never really make use of it for
anything.  I forgot it was set, and probably would have been pretty
surprised when it would actually have had an effect.

I know this kind of thing is incredibly difficult to accomodate, but
perhaps having the hadoop scripts deal with the potential output from cd
might be worthwhile.

Thanks for the tips,
C



On 7/18/07, Briggs <[EMAIL PROTECTED]> wrote:

Good call Ted.  I guess a 'which cd' might help to find out.


On 7/18/07, Ted Dunning < [EMAIL PROTECTED]> wrote:
>
> It sounds to me like you have somehow aliased cd.  This may be due to a
> sysadmin being too clever or due to your own profile.  Needless to say,
this
> is really bad practice.
>
> Here is what I see on Redhat:
>
> -bash-3.00$ cd /tmp
> -bash-3.00$
>
> (no output from cd)
>
>
> On 7/18/07 9:15 AM, "charlie w" < [EMAIL PROTECTED] > wrote:
>
> > Specifically this:
> >
> > bin=`dirname "$0"`
> > bin=`cd "$bin"; pwd`
> >
> > . "$bin"/hadoop-config.sh
> >
> > The problem is that the 'cd' command on cygwin and Fedora is not
silent, so
> > if one tries:
> >
> > bin/hadoop namenode format
> >
> > one winds up with this output:
> >
> > bin/hadoop: line 22: /home/charlie/hadoop-0.13.0/bin
> > /home/charlie/bin/hadoop-config.sh: No such file or directory
> >
> > It appears that simply adding >/dev/null to the cd command fixes
things:
> >
> >  bin=`cd "$bin" > /dev/null; pwd`
>
>


--
"Conscious decisions by conscious minds are what make reality real"

Reply via email to