ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hey, I'm trying to figure this one out. Maybe you can help me. Here's what I got:
echo "Enter the partition where LFS is to be installed (/mnt/lfs):"
if [ ! $LFS ]
Now, when I run this, it works fine, however, when it exits back to the shell, I type in "echo $LFS" and it prints an empty line. It's my undestanding that LFS should be a global variable and should be available after the program exits. Am I wrong?
Actually, I haven't yet started the installation of LFS, this is just a generic question regarding global variables. But, yes, my plans are to create an automatic install script. Why? Because I've gone through the whole thing 4 times now, and it's getting boring.
Originally posted by dtheorem Actually, I haven't yet started the installation of LFS, this is just a generic question regarding global variables. But, yes, my plans are to create an automatic install script. Why? Because I've gone through the whole thing 4 times now, and it's getting boring.
There is already a full project towards automating the build, you can find links through the LFS homepage. There is also a Makefile available at Christophe Devine's (?) home directory on the main LFS server.
To answer your question more fully: the script is launched in a new instance of the shell, and thus is not affecting your current instance. However, any script run from within that sub-shell will have that environmental variable ( as far as I know ).
You seem to be misunderstanding how environment variable works. They are not global to the system. Rather, each process inherits a copy of the parent's envvars. So in your case, when the child script exits, any envvars it creates are also lost.
Thank-you for your explanations. They were very helpful. In regards to ALFS, I've tried many times to install it, but I run Mandrake 9.2 and there's a universal law that says ALFS does not install under Mandrake 9.2. We always get an error with libxml2. Anyway, my script is teaching me a lot about bash programming, which is always a plus.