How can I set a username and password as variables in csh script using files that contain the username or password?
So within the first shell script, something like:
username=usernamefile.txt; export username
password=passwordfile.txt; export password
Currently in scripts I see the passwords hardcoded but I don’t want those in the script, I want to put the username and password into other files and then just point to those for the variables I will call later.
currently, if the username is pleasehelp and the password was 1234, then the current script reads:
username=pleasehelp; export username
password=1234; export password
I took the username and password and created files with just those inputs, but now I need to figure out how to let the script interpret that instead of the hardcoded passwords.
All through subsequent scripts, called from this script, are calls to those variables, so I am trying to only make changes on the declarations if possible.
The references read like this:
${HOME}/sqlplus -s ${username}/${password}@${databasename} /path/sqlfilename
I would like to not change the above line at all.
so if I put the password in a password.txt file, how can I declare that, export as password, and allow the rest of the script run as normal?
teejay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.