Hi Jean,
Thanks! You led me to a solution.
I couldn’t use yours directly, because the worksheet filename, and the
values of the arguments in the template are dynamic, created within the
surrounding Perl code. I couldn’t figure out how to feed those to the
shell script as args to Perl’s `system` command from entirely within
the Perl code. But I found a workaround by putting the shell script in a
separate file. (My larger program can create that earlier in the setup
for a project, so no prob.)
So, simplified, this is what works:
In a separate executable shell script file, named here make_wksht.sh:
#!/bin/sh
FILE=$1;
TMPL=$2;
echo "$TMPL" | bbedit --worksheet -t "$FILE";
In the main Perl script:
#!/perl
# . . .
# faked here for demo:
my $project = 'abc';
my $dir = '/Users/me/test';
my $wksht_file_name = ‘ws_test_01’;
my $wksht_tmpl = <<TMPL;
A='project=$project'
B='base_dir=$dir'
perl my_project_analyzer.pl "$A" "$B"
#-#-#
TMPL
my $sh_script = './make_wksht.sh';
my $wksht_file_name = 'test_01.worksheet';
system "$script", "$wksht_file_name", “$wksht_tmpl”;
__END__
I expect there’s a way to accomplish this without the external shell
script - maybe just a matter of reconciling quoting between the shell
and Perl.
Meanwhile, I can move on with my larger project, and this helps a lot
for testing as I go!
Thanks!
On 5 Apr 2021, at 13:09, jj wrote:
Hi Bruce,
Here is an intend to do this with a shell script (if I understood
correctly
your problem).
The --worksheet flag has to be used with a -t flag naming the
worksheet,
otherwise BBEdit appears to create a second document with the passed
name.
```shell
#! /bin/sh
WORKSHEET="ws_test_01" ;
CONTENT=$(cat <<'EOF'
A=‘project=abc’
B=‘base_dir=/Users/me/tests’
perl my_project_analyzer.pl “$A” “$G”
EOF
)
echo "$CONTENT" | bbedit --worksheet -t "$WORKSHEET";
```
HTH
Jean Jourdain
--
This is the BBEdit Talk public discussion group. If you have a feature
request or need technical support, please email
"[email protected]" rather than posting here. Follow @bbedit on
Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/e6e3f22c-5bc8-4af7-b18a-03b99e9fc2b9n%40googlegroups.com.
Thanks,
- Bruce
_bruce__van_allen__santa_cruz__ca
--
This is the BBEdit Talk public discussion group. If you have a feature request or need
technical support, please email "[email protected]" rather than posting here.
Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/8B241D96-41EA-4136-BC78-8C2BEF6ABB6E%40cruzio.com.