Sponsored Content
Full Discussion: ksh functions
Top Forums Shell Programming and Scripting ksh functions Post 302125638 by scriptingmani on Friday 6th of July 2007 06:22:40 AM
Old 07-06-2007
ksh functions

Hi All,

just wanted to ask if functions created in a Korn shell script can be passed parameters and if so what is the syntax for creating a function with parameters?

thanks

Mani
 

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
scdscreate(1HA) 					       Sun Cluster Commands						   scdscreate(1HA)

NAME
scdscreate - create a Sun Cluster resource type template SYNOPSIS
scdscreate -V vendor_id -T resource_type_name -a [-s] [-n RT_version] [-d working_directory] [-k | -g] DESCRIPTION
The scdscreate command creates a template for making an application highly available (HA) or scalable. This command enables you to create C-, Generic Data Service (GDS)-, or Korn shell-based templates for both network aware (client-server model) and non-network aware (client- less) applications. You can create the template in one of two fundamentally different ways: GDS scdscreate creates a set of three driving scripts that work from a single resource type SUNW.gds, which is pre- installed on the cluster. These scripts are named startRT_Name, stopRT_Name, and removeRT_Name and starts, stops, and removes an instance of that application. In this model, the implementation of the SUNW.gds resource type that is pre-installed on the cluster is immutable. Generated Source Code scdscreate creates a template for a Sun Cluster resource type, whose instantiations run under the control of the Resource Group Manager (RGM) to make the given application highly available and scalable. Either model can create templates for network aware (client-server model) and non-network aware (client-less) applications. scdscreate creates a directory of the form $vendor_id$resource_type_name under working_directory. This directory contains the driving scripts, or the generated source, binary, and package files for the resource type. scdscreate also creates a configuration file, rtconfig, in which you can store configuration information for the resource type. scdscreate allows you to create only one resource type per direc- tory. You must create different resource types in different directories. OPTIONS
The following options are supported: -a This parameter specifies that the resource type that is being created is not network aware. scdscreate disables all the networking related code in the template that is created. -n RT_version This optional parameter specifies the version of the generated resource's type. If you omit this parameter, and you're creating a C- or Korn shell-based application, the text string 1.0 is used by default. If you omit this parameter, and you're creating a GDS-based application, the RT_version string of the GDS is used by default. The RT_version distinguishes between multiple registered versions, or upgrades, of the same base resource type. You cannot include the following characters in RT_version: blank, tab, slash (/), backslash (), asterisk (*), question mark (?), comma (,), semicolon (;), left square bracket ([), or right square bracket (]). -d working_directory Creates the template for the resource type in a directory other than the current directory. If you omit this argument, scdscreate creates the template in the current directory. -g This optional parameter generates the GDS-based form of the template to make an application highly available or scalable. -k This optional parameter generates source code in Korn shell command syntax rather than in C. See ksh(1). -s This optional parameter indicates that the resource type is scalable. You can configure an instance (resource) of a scalable resource type into a failover resource group, and hence, turn off the scalability feature. If you omit this argument, scdscreate creates the template for a failover resource type. -T resource_type_name The resource type name and resource type version, in conjunction with the vendor ID, uniquely identifies the resource type that is being created. -V vendor_id The vendor ID is typically the stock symbol, or some other identifier of the vendor that is creating the resource type. scdscreate affixes the vendor ID, followed by a period (.) to the beginning of the resource type name. This syntax ensures that the resource type name remains unique if more than one vendor uses the same resource type name. EXIT STATUS
0 The command completed successfully. nonzero An error occurred. FILES
working_directory/rtconfig Contains information from the previous session and facilitates the quit and restart feature of scdscre- ate. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscdev | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
ksh(1), scdsbuilder(1HA), scdsconfig(1HA), attributes(5), rt_properties(5) Sun Cluster Data Services Developer's Guide for Solaris OS Sun Cluster 3.2 26 May 2004 scdscreate(1HA)
All times are GMT -4. The time now is 11:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy