I would like to store the names of all my hbase tables in an array inside my bash script.
- All
sed
hotfixes are acceptable. - All better solutions (like
readarray
it from some zookeeper file I am not aware of) are acceptable
I have two hbase tables called MY_TABLE_NAME_1
and MY_TABLE_NAME_2
, so what I want would be:
tables = (
MY_TABLE_NAME_1
MY_TABLE_NAME_2
)
What I tried:
Basing on HBase Shell in OS Scripts by Cloudera:
echo "list" | /path/to/hbase/bin/hbase shell -n > /home/me/hbase-tables
readarray -t tables < /home/me/hbase-tables
but inside my /home/me/hbase-tables
is:
MY_TABLE_NAME_1
MY_TABLE_NAME_2
2 row(s) in 0.3310 seconds
MY_TABLE_NAME_1
MY_TABLE_NAME_2