#!/usr/bin/perl use v5.030; # strictness implied use warnings; use Path::Tiny; use Time::Piece; use Log::Log4perl; use IPC::System::Simple qw/systemx capturex/; use utf8; my ($argv1) = @ARGV; if (not defined $argv1) { die "Need argv1\n"; } my $t = localtime; my $jd = $t->julian_day; my $log_conf4 = '/home/fritz/Documents/perlmonks/conf_files/4.conf'; Log::Log4perl::init($log_conf4); #info my $logger = Log::Log4perl->get_logger(); $logger->info("Time is $t"); $logger->info("Julian day is $jd"); $logger->info("$0"); my ($path) = @ARGV; if (not defined $path) { die "Need path in\n"; } my $file_in = path("$path"); my @lines = $file_in->lines_utf8; my @commands; # for my $line (@lines){ if ( $line =~ /^(?:#|$)/){ say "line matched $line"; next; } else { push( @commands, $line ); } } say @commands; say "cardinality: ", scalar @commands; #my $capture = capturex "bash", @commands; #$logger->info("capx: $capture"); my $target_dir = path('/tmp'); my $tempfile = $target_dir->tempfile('foobarXXXXXX'); $tempfile->spew("@commands"); # not atomic my $capture = capturex "bash", $tempfile; $logger->info("capx: $capture"); __END__