Sponsored Content
Full Discussion: ksh functions
Top Forums Shell Programming and Scripting ksh functions Post 302125642 by jim mcnamara on Friday 6th of July 2007 06:45:48 AM
Old 07-06-2007
Yes - example
Code:
myfunction()
{
    echo "$1 $2"
}

myfunction "This is parameter 1"  " Another parameter"
myfunction  32 64

You call the function with a list of parms, inside the function the parms are identified by $n where n is the number of the parameter.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to exit the KSH functions

Hi I am having the script which contains more functions. I want to exit the function if any failure. I tried with exit - the session itself is getting logged out. How can i fix this issue? (11 Replies)
Discussion started by: sharif
11 Replies

2. Shell Programming and Scripting

KSH Functions String return

Hy everybody I'm trying to write a function like function(){ final=$1 return $final } but I get following error: "return: bad non-numeric arg ''" what shall I do? Isn't it possible to return strings?:confused: thanks lucae (2 Replies)
Discussion started by: lucae
2 Replies

3. Shell Programming and Scripting

functions

I have korn shells where I want to create a function passing $1 to a function , determine my $STAT_ENV value, set the paths and return the paths for STATSH,STATPRM,STATSQR,STATSQL,STATCTL TO BE USED IN THE UNIX SCRIPT THE CALLED THE fucnction in the first place. Can someone tell me the best... (2 Replies)
Discussion started by: TimHortons
2 Replies

4. Shell Programming and Scripting

Passing array to functions in ksh script

Let me know if there is a way to pass array to a funtion in ksh script. function isPresent { typeset member member=$1 dbList=$2 echo '$1:' $1 echo '$2' $dbList The array will be at the second position....something like this isPresent 12 <array> if then echo... (3 Replies)
Discussion started by: prasperl
3 Replies

5. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

6. UNIX for Dummies Questions & Answers

Help with functions

Hi, I am exploring with defining functions in my BASH shell scripts. However, I am bit confused about how to pass parameters to my functions. I was under the impression that you must do something like the following: Define a function called "sample_function": function sample_function {... (3 Replies)
Discussion started by: msb65
3 Replies

7. UNIX for Dummies Questions & Answers

== vs -eq and functions

Hey I have a question.... what is the difference between using == vs -eq when testing in WHILE loops. I use the following test that only worked with == signs.... if why do i need == and not -eq? 2. I need to re-use some code in a couple places in this script. is functions my best... (5 Replies)
Discussion started by: danieldcc
5 Replies

8. Programming

Functions

Hi All, Can any one help me. I am calling in a function2 with string as parameter from function1, the function1 gives 3 values. how i get the 3 values from funciton2 to function1. i have to give a return or something. thanks in advance. (2 Replies)
Discussion started by: uday.sena.m
2 Replies

9. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies

10. Shell Programming and Scripting

ksh While Loop - passing variables to functions

I'm reading a text file using a while loop but when I call a function from within this loop it exits that same iteration … even though there are many more lines in the file to be read. I thought it was something to do with the IFS setting but it appears that a function call (when run... (3 Replies)
Discussion started by: user052009
3 Replies
Coverage(3pm)						User Contributed Perl Documentation					     Coverage(3pm)

NAME
Test::Pod::Coverage - Check for pod coverage in your distribution. VERSION
Version 1.08 SYNOPSIS
Checks for POD coverage in files for your distribution. use Test::Pod::Coverage tests=>1; pod_coverage_ok( "Foo::Bar", "Foo::Bar is covered" ); Can also be called with Pod::Coverage parms. use Test::Pod::Coverage tests=>1; pod_coverage_ok( "Foo::Bar", { also_private => [ qr/^[A-Z_]+$/ ], }, "Foo::Bar, with all-caps functions as privates", ); The Pod::Coverage parms are also useful for subclasses that don't re-document the parent class's methods. Here's an example from Mail::SRS. pod_coverage_ok( "Mail::SRS" ); # No exceptions # Define the three overridden methods. my $trustme = { trustme => [qr/^(new|parse|compile)$/] }; pod_coverage_ok( "Mail::SRS::DB", $trustme ); pod_coverage_ok( "Mail::SRS::Guarded", $trustme ); pod_coverage_ok( "Mail::SRS::Reversable", $trustme ); pod_coverage_ok( "Mail::SRS::Shortcut", $trustme ); Alternately, you could use Pod::Coverage::CountParents, which always allows a subclass to reimplement its parents' methods without redocu- menting them. For example: my $trustparents = { coverage_class => 'Pod::Coverage::CountParents' }; pod_coverage_ok( "IO::Handle::Frayed", $trustparents ); (The "coverage_class" parameter is not passed to the coverage class with other parameters.) If you want POD coverage for your module, but don't want to make Test::Pod::Coverage a prerequisite for installing, create the following as your t/pod-coverage.t file: use Test::More; eval "use Test::Pod::Coverage"; plan skip_all => "Test::Pod::Coverage required for testing pod coverage" if $@; plan tests => 1; pod_coverage_ok( "Pod::Master::Html"); Finally, Module authors can include the following in a t/pod-coverage.t file and have "Test::Pod::Coverage" automatically find and check all modules in the module distribution: use Test::More; eval "use Test::Pod::Coverage 1.00"; plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; all_pod_coverage_ok(); FUNCTIONS
All functions listed below are exported to the calling namespace. all_pod_coverage_ok( [$parms, ] $msg ) Checks that the POD code in all modules in the distro have proper POD coverage. If the $parms hashref if passed in, they're passed into the "Pod::Coverage" object that the function uses. Check the Pod::Coverage manual for what those can be. The exception is the "coverage_class" parameter, which specifies a class to use for coverage testing. It defaults to "Pod::Coverage". pod_coverage_ok( $module, [$parms, ] $msg ) Checks that the POD code in $module has proper POD coverage. If the $parms hashref if passed in, they're passed into the "Pod::Coverage" object that the function uses. Check the Pod::Coverage manual for what those can be. The exception is the "coverage_class" parameter, which specifies a class to use for coverage testing. It defaults to "Pod::Coverage". all_modules( [@dirs] ) Returns a list of all modules in $dir and in directories below. If no directories are passed, it defaults to blib if blib exists, or lib if not. Note that the modules are as "Foo::Bar", not "Foo/Bar.pm". The order of the files returned is machine-dependent. If you want them sorted, you'll have to sort them yourself. BUGS
Please report any bugs or feature requests to "bug-test-pod-coverage at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Pod-Coverage>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT
You can find documentation for this module with the perldoc command. perldoc Test::Pod::Coverage You can also look for information at: * AnnoCPAN: Annotated CPAN documentation <http://annocpan.org/dist/Test-Pod-Coverage> * CPAN Ratings <http://cpanratings.perl.org/d/Test-Pod-Coverage> * RT: CPAN's request tracker <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Pod-Coverage> * Search CPAN <http://search.cpan.org/dist/Test-Pod-Coverage> AUTHOR
Written by Andy Lester, "<andy at petdance.com>". ACKNOWLEDGEMENTS
Thanks to Ricardo Signes for patches, and Richard Clamp for writing Pod::Coverage. COPYRIGHT &; LICENSE Copyright 2006, Andy Lester, All Rights Reserved. You may use, modify, and distribute this package under the same terms as Perl itself. perl v5.8.8 2008-03-04 Coverage(3pm)
All times are GMT -4. The time now is 09:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy