2

i am trying to fetch the data value for a key in hbase shell. i am passing key value in command line argument for which it calculating md5sum in shell script and should scan in hbase.

following is my shell script:

#!/bin/bash
echo "cookieId: $1"
md5_hash="$(echo -n "$1"| md5sum | awk '{print $1}')"
echo "$md5_hash"
echo "get 'VIZVR_profile','md5_hash'" | "hbase shell"

command which i am running :

sh hbase.sh "abcd"

but it is throwing error as :

hbase.sh: line 5: hbase: command not found
hbase.sh: line 5: : command not found

can anybody help me to run this hbase shell command through shell script.

1 Answer 1

3

Updating the 5th line in your script to the below line should solve the problem:

echo "get 'VIZVR_profile','md5_hash'" | hbase shell

Explain

When you execute the following command:

echo "get 'VIZVR_profile','md5_hash'" | "hbase shell"

The echo command is piped into the following command "hbase shell"

The problem here, is that there is no command named "hbase shell"

The command is hbase with parameter shell

Removing the quote should solve the problem (assuming that hbase is in your path).

Note: You might need to replace hbase in the 5th line the script with full/path/to/hbase

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.