my $capture = capturex "bash","2.create.bash", "@ARGV"; $logger->info("capx: $capture"); #### fritz@laptop:~/Documents/gitlab1$ ./4.wrap.pl 2.millcreek.pl Time is Thu Mar 2 01:43:55 2023 Julian day is 2460005.86383102 ./4.wrap.pl capx: The shebang is specifying bash Using bash 5.0.17(1)-release 2 3 3.millcreek.pl -rwxrwxr-x 1 fritz fritz 11K Mar 2 01:43 3.millcreek.pl fritz@laptop:~/Documents/gitlab1$ #### #!/usr/bin/perl use v5.030; # strictness implied use warnings; use Path::Tiny; my ($path) = @ARGV; if (not defined $path) { die "Need path in\n"; } my $file_in = path("$path"); my @lines = $file_in->lines_utf8; my @matching; for my $line (@lines){ if ( $line =~ /^#*$/){ say "line matched $line"; next; } else { push( @matching, $line ); } } say @matching; say "cardinality: ", scalar @matching; my $target_dir = path('/tmp'); my $tempfile = $target_dir->tempfile('foobarXXXXXX'); $tempfile->spew("@matching"); # not atomic __END__ #### fritz@laptop:~/Documents/gitlab1$ ./1.wrap.pl 3.git.sh line matched #!/bin/bash pwd >2.txt #echo "starting fresh with rm -rf .git" #rm -rf .git | tee 1.txt #git init #ls >README.md git add *.pl git add *.sh git add *.txt #git remote add origin git@gitlab.com:perlmonks/$1.git git commit -m 'next revision' | tee 2.txt git push -uf origin master | tee 2.txt #git push -uf master main | tee 2.txt cardinality: 13 fritz@laptop:~/Documents/gitlab1$