I would use a '.sh' file and pass my hive query as either hive -e 'query' or hive -f 'query.hql'
In bash, it would be very easy to achieve you require.