Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
I'm very new to linux and am currently creating a very simple file backup script in bash and I am using Ubuntu.
I am calling backup.sh script from within the terminal using sudo bash backup.sh.
I have a configuration file separate from backup.sh (for ease of upgrade etc) , that contains variables e.g. email address to send logs to, location of log file, location of backup files etc. Both backup.sh and the config file will reside in the same folder.
How do I make the variables available to backup.sh – easiest way possible – as you guess by my question I'm a novice!
Similar question to the original, I have written a couple of functions that I am having to repeat across a couple of scripts (within the same back-up application) - is there a similar method for creating like a global (or sourcing file) where I can call them from?
Thanks
Similar question to the original, I have written a couple of functions that I am having to repeat across a couple of scripts (within the same back-up application) - is there a similar method for creating like a global (or sourcing file) where I can call them from?
Thanks
As far as I know, you could use exactly the same method, ie. sourcing:
Great, looks to be working by calling by:
. Configuration/myfunctions.sh
and then calling the function without containing the brackets e.g.
Logging_Events_Errors1
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.