Q1) How can I pass the variables through bash?
Is it possible to set variables on the shell script (so I can change table names in the for loop to deal with multiple tables with one script) something like this?
export tbl_name=$1
##(Attempt1)
/opt/vertica/bin/vsql -d $db_name -U $db_usr --password $db_passwd -c "\\set tbl_name '$tbl_name' \\echo :tbl_name" >> ${exec_log}
##(Attempt2)
echo "\\set tbl_name Indeg" |/opt/vertica/bin/vsql -d $db_name -U $db_usr --password $db_passwd
##(Attempt3)
/opt/vertica/bin/vsql -d $db_name -U $db_usr --password $db_passwd --variable tbl_name $1
FYI, Q2) I found answer on a code at a git repository. (although I think there's a documentation for it as well)
https://github.com/DougHarmon/v-sql-tb/tree/master/bin
and the specific code I looked at is :
https://github.com/DougHarmon/v-sql-tb/blob/master/bin/ahm_lag_alert.sh
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.