i have to write a bash script wherein i need to connect with oracle database and perform some queries. `sqlplus $DB_USER/$DB_PASSWORD' These variables are stored in another file "rangerenv.sh" How do i use these variables in another bash file?
You could extract those values into a separate config file that both scripts can access. Your script can use source
load the variables from this file.
config
file
DB_USER="user"
DB_PASSWORD="password"
your script
source config
sqlplus $DB_USER/$DB_PASSWORD
Be careful mixing sensitive variables with your code as they can end up in source control, backups or other places where they may be exposed to malicious actors. If these credentials exist in multiple files it can be difficult to rotate them and keep your database secure.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.