0

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

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
MosheCh
  • 99
  • 1
  • 12

2 Answers2

1

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.

redneb
  • 19,154
  • 5
  • 37
  • 52
1

You may use external " instead:

echo "truncate 'testTruncate' "|hbase shell 
SLePort
  • 14,775
  • 3
  • 30
  • 41