in reply to Sourcing Dot Config Files and Monitoring Make Processes
Now you can reinstate it using something like this program, which might be called "perform":#!/usr/bin/perl -w use strict; my $freezer = "frozen.env"; open (FROZEN, ">$freezer") || die "Could not write to $freezer\n"; foreach (keys %ENV) { print FROZEN "$_=$ENV{$_}\n"; } close (FROZEN);
Once you have established your environment, you would run the first program to "freeze" it. This would churn out a file called "frozen.env" which lists your various environment variables. Note that this program is not very robust, and multi-line entries are going to break it, so you may have to modify it accordingly.#!/usr/bin/perl -w use strict; my $freezer = "frozen.env"; open (FROZEN, $freezer) || die "Could not read saved environment $freezer\n"; while (<FROZEN>) { chomp; my ($var, $value) = /^([^=]+)=(.*)/; $ENV{$var} = $value; } close (FROZEN); system (@ARGV);
% perform makeNow, you can use a "dot config" file by replacing the value of $freezer with, perhaps, something like this:
my $freezer = (getpwuid($>))[7]."/.frozenrc";Note that the getpwuid call returns the home directory for the current user, as defined in /etc/passwd, so this will likely not work in a Win32 environment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Sourcing Dot Config Files and Monitoring Make Processes
by hackdaddy (Hermit) on May 07, 2002 at 21:55 UTC | |
by tadman (Prior) on May 08, 2002 at 18:13 UTC |