Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Encapsulating HiveF commands with shell scripts in hive

Shulou Source: shulou.com Published: 2022-06-03 05:59:00 09月24日 Update

There is a hive-e command in hive that can pass parameters, but when there are too many hql statements, the whole shell script will appear messy. Of course, some people may say that hive-f can directly call a file,bingo, but there is still a big defect, that is, this cannot pass parameters, which is intolerable in actual work. So I came up with the idea of encapsulating a command HiveF, which can be passed directly into file and parameters. In fact, the implementation is very simple, let's share the code. Of course, it's not perfect. Let's throw a brick to attract jade.

#! / bin/bash

. / etc/profile

Cat $1 > $1.tmp

For arg in "$@"

Do

Echo "arg" $arg

Flag= `echo $arg | grep'-'`

If [$arg! = $1]; then

If [$flag]; then

Tmp= `echo $flag | sed Compact / `

Else

Sed-I s / {$tmp} / $arg/g $1.tmp

Echo "nothing"

Fi

Fi

Done

Hive-f $1.tmp

Rm-f $1.tmp

I hope I can help you again.

Tags: Parameters commands scripts encapsulation messy very large throw a brick to attract jade indeed code actually that is defects statements or work help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Xiaomi macOS Redmi Shulou Technology