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
  • 732,580
  • 175
  • 1,330
  • 1,459
MosheCh
  • 99
  • 3
  • 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
  • 21,794
  • 6
  • 42
  • 54
1

You may use external " instead:

echo "truncate 'testTruncate' "|hbase shell 
SLePort
  • 15,211
  • 3
  • 34
  • 44