Sponsored Content
Top Forums Shell Programming and Scripting How to see a variable value outside a function in kshell Post 302369160 by somu_june on Friday 6th of November 2009 04:51:43 PM
Old 11-06-2009
Hi Guys,

Thanks for your help it is working fine if I do as you said

Code:
#!/bin/ksh
C_fun() {
  typeset TEXT=${1}
}
C_fun ${1}
echo Value of TEXT $TEXT

I have one more question on this. How can I Pass multiple parameters to a function above I'm passoing C_fun ${1} only . I want to pass $2 also as an parameter to a function I tried by placing comma like C_fun ${1},${2} but this is giving me Value of Text F,Fail. How to pass multiple parameters to a function and see its value.

---------- Post updated at 04:51 PM ---------- Previous update was at 04:45 PM ----------

Here is my script


Code:
#!/bin/ksh
C_fun() {
typeset TEXT=${1}
typeset  Stat=${2}
}
C_fun ${1},${2}
echo Value of TEXT $TEXT
echo Value of Stat $Stat


But it is giving me
Code:
Value of TEXT F,Fail
Value of Stat

Value of Stat is empty I need to get its value as Fail and Text Value as F since $1 is F and $2 is Fail

I think this post will be more clear then previous one.

Thanks,
Raju.

Last edited by Franklin52; 11-06-2009 at 05:58 PM.. Reason: Please use code tags!!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

passing a variable inside a variable to a function

I would like to know how to pass a variable inside a variable to a function. sample code below -------------- for x in 1 9 do check_null $C$x ##call function to check if the value is null if then echo "line number:$var_cnt,... (2 Replies)
Discussion started by: KingVikram
2 Replies

2. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

3. Shell Programming and Scripting

Variable value not retaining outside function

Hi All, As per my understanding, value of variable is retained outside function. But the value of array myarrayDriver is not retained outside function. Could you please tell the reason for the same.. code: readingConfigFile() { search_keyword="$1" i=0 for pointer in $(cat... (7 Replies)
Discussion started by: ajincoep
7 Replies

4. UNIX for Dummies Questions & Answers

function not see variable in script

Hi Forum Can anyone tell me whats wrong with my script. What i want to do read in values from a input file using a while loop then taking that input from the file into a function that i created. Every time i execute the script it goes through the while loop but the function doesn't see the... (10 Replies)
Discussion started by: ShinTec
10 Replies

5. Shell Programming and Scripting

How to pass a function with a variable parameter into another variable?

Hello again :) Am currently trying to write a function which will delete a record from a file. The code currently looks as such: function deleteRecord() { clear read -p "Please enter the ID of the record you wish to remove: " strID ... (2 Replies)
Discussion started by: U_C_Dispatj
2 Replies

6. UNIX for Dummies Questions & Answers

Passing variable to Alias in Hp kshell

Hi all, I have a series of directories which i open regularly. I want create an alias so that i can pass the direcotry name to alias and then this commands makes Cd to the path i need. COuld you please help on how to create an alias ex of what i am trying but couldn't succeeded #alias... (1 Reply)
Discussion started by: firestar
1 Replies

7. Shell Programming and Scripting

function for variable files

hi all this is my function #! /bin/sh awk '/ Type/ { print "m;" $4 } /IDf/ {print $3 } /IuSac/ { print $3 } /IuSac/ { print $1 }' / IBM.txt |tr '\n' ';'| perl -pi -e 's/;m//g'|cut -d ";" -f 2-5 ' >> 2m 1) i wanna make it to save output of awk in a file named by date in order not to... (3 Replies)
Discussion started by: teefa
3 Replies

8. Shell Programming and Scripting

Please help with Kshell Script!

I am an AIX noobie, and have a question around an AIX 5.2 script that I need to run. Security Audit requires us to have no World Writable files on our server, but every time we restart the Domino server on AIX it re-flags two files as World Writable. I have a little script that I created that... (5 Replies)
Discussion started by: Nebs
5 Replies

9. Shell Programming and Scripting

Passing variable value in a function to be used by another function

Hello All, I would like to ask help from you on how to pass variable value from a function that has been called inside the function. I have created below and put the variables in " ". Is there another way I can do this? Thank you in advance. readtasklist() { while read -r mod ver... (1 Reply)
Discussion started by: aderamos12
1 Replies

10. Shell Programming and Scripting

How to pass variable from one function to another function?

updateEnvironmentField() { linewithoutquotes=`echo $LINE | tr -d '"'` b() } I want to pass variable named $linewithoutquotes to another method called b(), which is called from updateEnvironmentField() method. How to do the above requirement with shell script (1 Reply)
Discussion started by: pottic
1 Replies
CREATE TEXT SEARCH 
TEMPLATE(7) PostgreSQL 9.2.7 Documentation CREATE TEXT SEARCH TEMPLATE(7) NAME
CREATE_TEXT_SEARCH_TEMPLATE - define a new text search template SYNOPSIS
CREATE TEXT SEARCH TEMPLATE name ( [ INIT = init_function , ] LEXIZE = lexize_function ) DESCRIPTION
CREATE TEXT SEARCH TEMPLATE creates a new text search template. Text search templates define the functions that implement text search dictionaries. A template is not useful by itself, but must be instantiated as a dictionary to be used. The dictionary typically specifies parameters to be given to the template functions. If a schema name is given then the text search template is created in the specified schema. Otherwise it is created in the current schema. You must be a superuser to use CREATE TEXT SEARCH TEMPLATE. This restriction is made because an erroneous text search template definition could confuse or even crash the server. The reason for separating templates from dictionaries is that a template encapsulates the "unsafe" aspects of defining a dictionary. The parameters that can be set when defining a dictionary are safe for unprivileged users to set, and so creating a dictionary need not be a privileged operation. Refer to Chapter 12, Full Text Search, in the documentation for further information. PARAMETERS
name The name of the text search template to be created. The name can be schema-qualified. init_function The name of the init function for the template. lexize_function The name of the lexize function for the template. The function names can be schema-qualified if necessary. Argument types are not given, since the argument list for each type of function is predetermined. The lexize function is required, but the init function is optional. The arguments can appear in any order, not only the one shown above. COMPATIBILITY
There is no CREATE TEXT SEARCH TEMPLATE statement in the SQL standard. SEE ALSO
ALTER TEXT SEARCH TEMPLATE (ALTER_TEXT_SEARCH_TEMPLATE(7)), DROP TEXT SEARCH TEMPLATE (DROP_TEXT_SEARCH_TEMPLATE(7)) PostgreSQL 9.2.7 2014-02-17 CREATE TEXT SEARCH TEMPLATE(7)
All times are GMT -4. The time now is 08:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy