Reputation: 11
I am writing shell script which will read a table name from a file, and pass table name to hive query.
But i assume $
not recognized in hive.
Any idea how can I pass the variable in hive query?
Error : can not recognize input near $i
#!/bin/bash
#Input file
ifile="/tmp/table.txt"
if [[ -f "$ifile" ]]
then
while IFS= read -r i
hive -e "show create table $i"
done <"$ifile"
fi
$cat table.txt
office.empoyee
office.department
office.floor
Upvotes: 0
Views: 450
Reputation: 17268
I think all that is missing here is the do
after the while
line:
if [[ -f "$ifile" ]]
then
while IFS= read -r i
do
hive -e "show create table ${i}"
done <"$ifile"
fi
Upvotes: 3