Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So I have a short bash script written with the goal of being able to download a zip folder containing credentials for a software program, unzip them and source them. Unfortunately the sourcing is not taking place, or if it is, it only lasts during the execution of the script and not outside it. Problem is I need it to be effective outside of the script. So, the script looks like so:
get-creds.sh
#!/bin/bash
yum install unzip -y
mkdir .creds
cd .creds
/usr/sbin/euca_conf --get-credentials admin.zip
unzip admin.zip
source eucarc
cd
I execute it from the terminal like so: ./folder/folder/folder/get-creds.sh
how can I set up the script so that that source command works outside the script as well? The credentials file needs to be sourced to run some commands and I want it as automated as possible.
Do the creds change from download to download?
If not, just leave eucarc somewhere (one directory above?) and use source /path/to/eucarc
in your ~/.bashrc file.
Yes the creds will change from download to download.
The script will be run as the initial install, users may need to source the cred file again at a later point manually if they exit the terminal/close the remote session or whatever. Or if for some reason the programs database needs overwritten new credentials will have to be downloaded and sourced. The path however will not change, unless the user messes up and puts it somewhere else in the scenario that they need to be redownloaded.
I'm not sure that will work for my scenario. These scripts are supposed to be part of an install suite that will make the installation process of some bundled software more simple for the people we distribute it to...unless I create a script that modifies or overwrites the bashrc with a version matching what I'd need it to look like. Also, yes the .creds directory needs to stick around permanently.
I'm not sure that will work for my scenario. These scripts are supposed to be part of an install suite that will make the installation process of some bundled software more simple for the people we distribute it to...unless I create a script that modifies or overwrites the bashrc with a version matching what I'd need it to look like. Also, yes the .creds directory needs to stick around permanently.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.