If you are using a version of hbase with the option "--non-interactive / -n", for example, Cloudera :
#!/bin/bash
echo 'list' | hbase shell -n
status=$?
if [$status -ne 0]; then
echo "The command may have failed."
fi
If you use hbase 1.0.0 without "--non-interactive", you can load commands from a file. Example from HBase Documentation :
echo "create 'test', 'cf'" > ./sample_commands.txt
hbase shell ./sample_commands.txt
source
share