I have this simple script:

$(hadoop fs -ls)

The output is:

./hello.sh: line 3: Found: command not found

So bash definitely sees HADOOP_HOME. I've set it in ~/.profile and added path to bin folder:

export HADOOP_HOME="/opt/hadoop-0.20.2-cdh3u2"

If I simply invoke command in console everything works but inside a script it doesn't. What am I doing wrong?


It's not the problem with echo ${HADOOP_HOME} command.The one which causes the error is $(hadoop fs -ls)

You have to give the 3rd line in that script as echo $(hadoop fs -ls). So the script will look like,

echo $(hadoop fs -ls)

If you give the command like this $(hadoop fs -ls), bash parses it and find it's value. And the founded value is again parsed by bash.


$ var=4
$ $var
4: command not found
$ echo $var

IMO, the value or the output of the command hadoop fs -ls is Found, this string found was again parsed by bash when you give the command like this $(hadoop fs -ls). So that the below error message displayed while executing the script hello.sh,

./hello.sh: line 3: Found: command not found
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.