Inside bash, you can do something like this:
EXPORT_CMD=/tmp/${0}_exports.bsh perl ... chmod +x $EXPORT_CMD $EXPORT_CMD rm $EXPORT_CMD
Inside Perl it is:
sub export (@) { state $exh; unless ( $exh ) { my $export_cmd_path = $ENV{EXPORT_CMD}; open( $exh, '>>', $export_cmd_path ) or die "Could not open $export_cmd_path!" ; } while ( @_ > 1 ) { my ( $name, $value ) = (( uc shift ), shift );
And then this is just a coding question:
export LOC => '/tmp/1/';
The problem is that most programs cannot change the shell variables from which they were called.
source share