Reputation: 6371
I intend to enter the hive shell(as below) in a sh script and do some HQL request.
$ hive
Hive history file=/tmp/admin/hive_job_log_admin_201309110939_570764_8012_1eecdf83_1dd4da6d.txt
hive>
Then I got a script which could just work the way I want. The code snippet of sh script is as follows:
#!/bin/bash
#HQL
/home/hive/hive/bin/hive -u root -p root <<EOF
show tables;
EOF
But I don't know what exactly does <<EOF
and the last EOF
mean. Could anyone just give me a specific explanation on this? Thanks a lot!
Upvotes: 0
Views: 205
Reputation: 1268
EOF is just a common heredoc delineator it can be anything not just EOF it can be MyEOF ect. If you declare it like MyEOF then it will use the string MyEOF as a standard input and you can specify $MyEOF as variables which later you can use its contents as stdin. As Johnsyweb mentioned this is called a herestring, as it uses a short string in contrast to a whole block, as in a heredoc.
Upvotes: 0