CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [brunogon] Using functions from shell script: Edit Log



budman
User

Feb 12, 2012, 12:25 PM


Views: 6764
Re: [brunogon] Using functions from shell script

 
The only way you can access the functions is if they are sourced to environment of the system command:

script: functest.pl

Code
#!/usr/bin/perl 
my $cmd1 = "source functest.ksh; tester1 opt1 opt2";
my $cmd2 = "source functest.ksh; tester2 opt4 opt5";
system($cmd1);
system($cmd2);


script: functest.ksh

Code
#!/bin/ksh 
function tester1 {
echo "Running tester1 function $*"
}
function tester2 {
echo "Running tester2 function $*"
}


Output:
./functest.pl
Running tester1 function opt1 opt2
Running tester2 function opt4 opt5


(This post was edited by budman on Feb 12, 2012, 12:25 PM)


Edit Log:
Post edited by budman (User) on Feb 12, 2012, 12:25 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives