A bad thing about ALFS in c

Felipe Contreras al593181 at mail.mty.itesm.mx
Tue Nov 6 08:40:24 PST 2001

On Tue, Nov 06, 2001 at 02:19:07AM -0800, John Schmerge wrote:

> void
> doStuff(void)
> {
> 	putenv("LFS=/mnt/lfs");
> 	system("cd $LFS; ls");
> }

Yes that can also be done, but what if "cd $LFS" fails, how do you know
what command fails? What if I want display each command while it's
executing. In that case it should be:

        char *lfs;

That should work for most purposes of "chdir" and "export" but then what
if I some script needs bash substitution? For example "export
tmp=${LFS%/*}". Or what if there are some other commands that alter the
environment? Things go harder and harder, just because the commands of a
shell script need to run on the same shell, just as if you were
executing it. Unfortunately there is no easy way to interact with bash

Might be I'm thinking too much, but I just think it's much easier to run
shell scripts with bash than with c, and the easiest way to install a
package is by runing shell scripts. I'm pretty sure there can a lot of
ways to do it, I just think simple is better.

Felipe Contreras
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message

More information about the alfs-discuss mailing list