ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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 apparently, according to man pages, it just returns the return value from the script used as its argument. Or, it returns the error from the script used as its argument.
So
. /etc/rc.config
is kind of like saying "if rc.config runs fine, then do this, otherwise spit out the error"
Well, it also actually executes any commands in the sourced file in the current environment. In something like '. /etc/rc.config', it's saying to execute any commands in the file (including assignment to variables). The exit code is actually being ignored in that case.
Hmm..I don't know what I just read but it's pretty different from what you just told me. What you said makes more sense though. I've seen the . used in many contexts where your description is obviously the right one.
In the context you asked about, using the '.' or 'source' reads in the content of the named file and handles that content as if it were written into the script at the point where it is sourced from.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.