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.
In reply to Re: Sourcing Dot Config Files and Monitoring Make Processes
by tadman
in thread Sourcing Dot Config Files and Monitoring Make Processes
by hackdaddy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |