Thx, kcott,I can hardly believe this thing works, but it almost does:

fritz@laptop:~/Documents/gitlab1$ ./1.wrap.pl 3.git.sh Time is Tue Mar 7 22:43:27 2023 Julian day is 2460011.73850694 ./1.wrap.pl line matched #!/bin/bash line matched #echo "starting fresh with rm -rf .git" line matched #rm -rf .git | tee 1.txt line matched #git init line matched #ls >README.md line matched #git remote add origin git@gitlab.com:perlmonks/$1.git line matched #git push -uf master main | tee 2.txt line matched pwd >2.txt git add *.pl git add *.sh git add *.txt git commit -m 'next revision' | tee 2.txt git push -uf origin master | tee 2.txt cardinality: 6 Enumerating objects: 13, done. Counting objects: 100% (13/13), done. Delta compression using up to 4 threads Compressing objects: 100% (12/12), done. Writing objects: 100% (12/12), 5.47 KiB | 224.00 KiB/s, done. Total 12 (delta 3), reused 0 (delta 0) remote: remote: To create a merge request for master, visit: remote: https://gitlab.com/perlmonks/betelgeuse/-/merge_requests/new +?merge_request%5Bsource_branch%5D=master remote: To gitlab.com:perlmonks/betelgeuse.git 092deaf..5000f52 master -> master capx: [master 5000f52] next revision 11 files changed, 963 insertions(+) create mode 100644 1.aldeb.txt create mode 100755 1.wrap.pl create mode 100755 2.2023.pl create mode 100755 2.create.bash create mode 100755 2.wrap.pl create mode 100755 3.2023.pl create mode 100755 3.millcreek.pl create mode 100644 3.output.txt create mode 100644 3.wrap.pl create mode 100755 4.2023.pl create mode 100755 4.wrap.pl Branch 'master' set up to track remote branch 'master' from 'origin'. fritz@laptop:~/Documents/gitlab1$

Source:

#!/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__

What doesn't work? I created a merge request, but it won't merge.

Looking at the log, I'm amazed at what came through capturex:

2023/03/07 22:43:27 INFO Time is Tue Mar 7 22:43:27 2023 2023/03/07 22:43:27 INFO Julian day is 2460011.73850694 2023/03/07 22:43:27 INFO ./1.wrap.pl 2023/03/07 22:43:30 INFO capx: [master 5000f52] next revision 11 files changed, 963 insertions(+) create mode 100644 1.aldeb.txt create mode 100755 1.wrap.pl create mode 100755 2.2023.pl create mode 100755 2.create.bash create mode 100755 2.wrap.pl create mode 100755 3.2023.pl create mode 100755 3.millcreek.pl create mode 100644 3.output.txt create mode 100644 3.wrap.pl create mode 100755 4.2023.pl create mode 100755 4.wrap.pl Branch 'master' set up to track remote branch 'master' from 'origin'.

I'm still working through Git::Wrapper to abrogate this unusual approach, thx bliako++ for the tempfile idea.

Cheers from a land of snow,


In reply to Re^4: wrapping bash and astronomy by Aldebaran
in thread wrapping bash and astronomy by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.