1

I have a hive script which takes parameters in the form of --hivevar var_name="value" from beeline and the substitution works well within hive queries.

Within this hive script, I wanted to run a shell script with a variable passed as a parameter. I tried

!sh /home/tempscript {variable_name}

But the script does not take the substituted value, rather it passes the string '{variable-name}' to the shell script.

Any way to get around this?

  • coulc you please follow this - https://stackoverflow.com/questions/64864397/how-to-declare-and-use-variable-in-hive-sql/64871022#64871022 – Koushik Roy Nov 27 '20 at 08:30
  • It should be `${var_name}` - with dollar. – leftjoin Nov 27 '20 at 08:39
  • Hi, sorry for the confusion, I have edited the question so that it's more clearer – Kevin Bobby Nov 27 '20 at 10:10
  • @KevinBobby Did you ever find out the fix for this? I am wondering about using !sh in beeline too. It seems that if you use beeline and !sh echo "${var}", it will literally print "echo ${var}". – user7644509 Apr 15 '21 at 23:37
  • The problem is trying to do variable substitution within beeline while accessing shell from there. – user7644509 Apr 15 '21 at 23:57

0 Answers0