I want to do the following:
echo 'truncate \'testTruncate\' "|hbase shell
Probably the problem is with the ' char.
Do you know how can I solve it?
I get syntax error
You can include a ' in a string that is quoted by ' as follows:
echo 'O'\''Brien'
or
echo 'O'"'"'Brien'
In both case you will get O'Brien as output. Note that in both case, we there essetially 3 strings, one next to the other, e.g. 'O', \', 'Brien'.
This looks ugly, but unfortunately backslash escapes are not supported in single quoted strings in bash.
You may use external " instead:
echo "truncate 'testTruncate' "|hbase shell