Support Questions

Find answers, ask questions, and share your expertise

Beeline file name parameterize

New Contributor

I have a directory of say 10 SQL files and out of which I need to run only 5 SQL files. I am trying to achieve this by creating an array of only the five files that I need to execute and trying to call Beeline -f in for loop to execute the files . But the solution does not seem to be working . The SQL can be triggered when I run beeline -f mysqlfile.sql  


for eachline in "${testarray[@]}"
beeline -f '${eachline}'.sql



Master Collaborator

@Caliber ,


Not sure if this is the problem, but beeline has a known issue with terminal settings when running in the background.


Try adding this to your script, before the for loop:

export HADOOP_OPTS=-Djline.terminal=jline.UnsupportedTerminal





Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

Rising Star

@Caliber The following command should work:

# for hql in {a.hql,b.hql}; do beeline -n hive -p password --showheader=false --silent=true -f $hql; done