Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to include a file containing variables in a shell script

Tags:

linux

bash

sh

i have many script shell and i want to include a file containing variables in this shell

script?

My var script:

###################################################################################
ORACLE_LOGIN=login
ORACLE_PWD=pwd
CHEMIN_1="/home/"
CHEMIN_2="/scripts/"
LOG_FILE="$CHEMIN_1/max.log"
export ORACLE_SID=oracle_sid
###################################################################################

My script sh:

#!/bin/ksh
#set -x

# ==============   LOAD VAR HERE  ====================================
????

##################################################################
####                          Begin                           ####
##################################################################

write "Begin $0"  

$ORACLE_HOME/bin/sqlplus -s $ORACLE_LOGIN/$ORACLE_PWD@$ORACLE_SID <<EOF >> $LOG_FILE 2>&1 
@$CHEMIN_2/sp_rep_alim_dia_date_max.sql
exit
EOF

write "End."

Thx.

like image 360
Mercer Avatar asked Jul 08 '13 15:07

Mercer


1 Answers

. ./name_of_the_var_script

That’s dot + space + dot + slash + filename (because the “dot” utility needs an absolute or relative path to your var script).

like image 89
mirabilos Avatar answered Nov 12 '22 08:11

mirabilos