Say, I have a shell script like this:
utils.sh
function getDir
{
echo "DirName"
}
I want to use that function from a Perl script:
test.pl
`source utils.sh`;
my $dir_name = `getDir`;
print $dir_name;
But this is not working. How I can get this done? Essentially I need to get the return value from a shell function to a Perl script.
You’ll need to call that function in the same shell that sources
utils.sh, so: