9 'cat \Klog/' => '/var/log/apache2/',
12 my $filename = 'barcat';
13 open my $input, '<', $filename
14 or die "Cannot read documentation from $filename script\n";
17 while (readline $input) {
18 # find code snippets in the appropriate section
19 /^=head1 EXAMPLES/ ... /^=head1/ or next;
23 my ($name) = /[\h(]*([^|]+)/;
25 # prepare shell command to execute
27 while (my ($subcmd, $args) = each %CMDARGS) {
28 $subcmd .= " \\K", $args .= ' ' unless $subcmd =~ m/\\K/;
29 $cmd =~ s/\b$subcmd/$args/;
31 $cmd =~ s/'/'\\''/g, $cmd = "bash -c 'set -o pipefail\n$cmd'";
33 # run and report unexpected results