#!/usr/bin/env perl
# Last modified: Wed Jul 16 2025 12:52:52 PM -04:00 [EDT]
# Bash-functions.pl
use strict;
use v5.18;
use utf8;
use warnings;
local $ENV{'PERL5SHELL'} = q=/usr/bin/bash=;
local $ENV{'SHELL'} = q=/usr/bin/bash=;
my $spawnFH;
my $elist;
my $cPid = open( $spawnFH, q[-|], qq[$ENV{'PERL5SHELL'} -login command builtin declare -p -F] )
or die "Bad open from pipe: $!";
if ( $cPid ) {
$elist = join qq[], grep {/^declare -f/} <$spawnFH>;
close $spawnFH or warn qq/Bad close on process $cPid: $!|$?/;
}
print qq[Results from $cPid:\n], $elist, qq[\n];
__END__
####
$ perl Bash-functions.pl
Results from 3716:
declare -f SBP
declare -f exp
declare -f gawklibpath_append
declare -f gawklibpath_default
declare -f gawklibpath_prepend
declare -f gawkpath_append
declare -f gawkpath_default
declare -f gawkpath_prepend
declare -f profile_d
####
$ perl Bash-functions.pl
/usr/bin/bash: command: No such file or directory
Bad close on process 12284: |32512 at Downloads/Bash-functions.pl line 17.
Results from 12284: