[ 
https://issues.apache.org/jira/browse/HADOOP-6630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844639#action_12844639
 ] 

Allen Wittenauer commented on HADOOP-6630:
------------------------------------------

Actually, I misspoke a bit. It will be full path if it comes from $PATH.  If 
you call with a relative path, it will contain the relative path.

So to be more explicit:

if I put this code:

{code}
#!/bin/bash
echo $BASH_SOURCE
{code}

in $HOME/bin and make sure $HOME/bin is in my path, you'll see the following:

awittena-mn:bin awittena$ testexec
/Users/awittena/bin/testexec

awittena-mn:~ awittena$ bin/testexec
bin/testexec

awittena-mn:~ awittena$ cd bin && testexec
/Users/awittena/bin/testexec

awittena-mn:~ awittena$ cd bin && ./testexec
./testexec

So the cd+pwd combo is still needed, but this should fix the "in the $PATH" 
issue.  It is a shame that bash hid the "can't find hadoop-config.sh" error for 
the past few years.  If you run it with -x set, you'll see it tho.


> hadoop-config.sh fails to get executed if hadoop wrapper scripts are in path
> ----------------------------------------------------------------------------
>
>                 Key: HADOOP-6630
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6630
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 0.20.2
>            Reporter: Allen Wittenauer
>         Attachments: HADOOP-6630.txt
>
>
> If the hadoop/bin commands are in the path, hadoop-config.sh doesn't executed 
> until much later in the stack because $0 lacks a path.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to