Sponsored Content
Top Forums Shell Programming and Scripting Variable value not retaining outside function Post 302450292 by Scrutinizer on Thursday 2nd of September 2010 07:22:40 AM
Old 09-02-2010
I would look at the assignment inside the function, if I do a simple test:
Code:
$ funcA(){ A=(5 6 7 8); } ; funcA ;echo ${A[2]}
7

The value is retained..

You are testing ${myarrayDriver[1]} . Are you sure ${myarrayDriver[0]} gets set as well?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing data and retaining the full length of variable

Here's is an example of what I want to do: var1="Horse " var2="Cat " var3="Fish " for animals in "$var1" "$var2" "$var3" do set $animals pet=$1 ## Ok, now I want to get the values of $pet, but ## I want to retain the full length it was... (3 Replies)
Discussion started by: app4dxh
3 Replies

2. Shell Programming and Scripting

variable not retaining value

Bourne shell Solaris I'm trying to set a flag to perform an action only when data is found. So I initialize the flag with: X=0 Then I read the data: if ; then while read a b c do X=1 done < ${inputFile} fi The problem is that X will be set to 1 inside the while loop but when... (5 Replies)
Discussion started by: gillbates
5 Replies

3. UNIX for Dummies Questions & Answers

passing variable to function

Hi, I am trying to sum up numbered columns and in order to tidy up the program I have wrote a function to do the adding of some numbers. I have a problem though with passing a variable to the function in the UNIX bash shell. The function only gives the first number in the variable list and does... (4 Replies)
Discussion started by: Knotty
4 Replies

4. 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

5. 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

6. UNIX for Dummies Questions & Answers

Calling a function through a variable

Hey folks, I'm pretty new to unix programming. I was trying to get something to work but it's not doing what I expected. #!/bin/ksh . ./functions.sh STRING=function_1 FUNCTION="$STRING" RETURN=eval $FUNCTION echo "value of $FUNCTION function is: $RETURN" All i'm... (5 Replies)
Discussion started by: Irrational
5 Replies

7. 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

8. Shell Programming and Scripting

Help with retaining variable scope

Hi, I use Korn Shell. Searched Forum and modified the way the file is input to the while loop, but still the variable does not seem to be retaining the final count. while read name do Tmp=`echo $name | awk '{print $9 }'` Count=`cat $Tmp | wc -l`... (6 Replies)
Discussion started by: justchill
6 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
LedgerSMB::DBObject::EOY(3pm)				User Contributed Perl Documentation			     LedgerSMB::DBObject::EOY(3pm)

NAME
LedgerSMB::DBObject::EOY - End of Year handling module SYNOPSYS
This class contains methods for end of year entry. BASIC PROPERTIES
end_date specifies the end date for a closed period. reference specifies the gl reference field associated with the account closure description specifies the gl description field associated with the account closure retention_acc_id specifies the account id used as a retaining account. METHODS
$eoy->checkpoint_only(); This creates account checkpoints at $eoy->{end_date}. This has two uses: 1) Can be used to "close" books without zeroing income/expense accounts. This prevents data from being inserted for earlier dates. 2) This can be used to improve performance by creating a "lookback" point. $eoy->reopen_books() This reverses any end of year transaction on $eoy->{end_date}, and deletes checkpoints for that day. $eoy->close_books() Requires all properies in BASIC PROPERTIES to be set. This creates a gl yearend transaction, and moves income/expenses to the selected equity account for retained earnings. $eoy->list_earnings_accounts Returns a list of equity accounts, and sets $eoy->{earnings_accounts} to a list of hashrefs. These are used to select retained earnings accounts in closing books. COPYRYIGHT
Copyright (C) 2009 The LedgerSMB Core Team. This may be re-used as permitted by the GNU General Public License v 2 or at your option any later version. Please see included License.txt for details. perl v5.14.2 2012-03-25 LedgerSMB::DBObject::EOY(3pm)
All times are GMT -4. The time now is 01:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy