Skip to content

Instantly share code, notes, and snippets.

@ytnobody
Created January 23, 2014 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ytnobody/8571759 to your computer and use it in GitHub Desktop.
Save ytnobody/8571759 to your computer and use it in GitHub Desktop.
export env args
#!/usr/bin/env perl
use strict;
use warnings;
my $dir = $ARGV[0] || 'env';
mkdir $dir unless -d $dir;
my @data = `env`;
chdir $dir;
for my $entry (@data) {
chomp $entry;
my ($name, $val) = split('=', $entry, 2);
open my $fh, '>', $name or die $!;
print $fh $val;
close $fh;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment