Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Loading associative array from exported function Post 303040988 by jcdole on Monday 11th of November 2019 05:09:49 PM
Old 11-11-2019
Loading associative array from exported function

Hello.
I have an export of an associative array build using declare -p SOME_ARRAY_NAME > SOME_FILE_NAME.txt.
Producing some thing like
Code:
declare -A SOME_ARRAY_NAME=( [toto]="some_text"   [tata]="a_text"    ......... [last]="another_text" )

in a text file.


I have a stock of functions which are sourced from /etc/profile.local.

They are accessible for any script.
Moreover the associative array export file was created using one of these functions.

I can create an associative array by calling a function, but the array is not available outside the creative function.

Given a running script, by calling a function, I would like to create an associative array (with the same name as the name in the exported file) and fill it with the exported file.
The associative array should be available in the script calling the function and to any child script.

I would like to use only function and no hard coding.
Any help is welcome.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Associative Array

Hi, I am trying to make an associative array to use in a popup_menu on a website. Here is what i have: foreach $entr ( @entries ) { $temp_uid = $entr->get_value(uid); $temp_naam = $entr->get_value(sn); $s++; } This is the popup_menu i want to use it in. popup_menu(-name=>'modcon',... (4 Replies)
Discussion started by: tine
4 Replies

2. Shell Programming and Scripting

Function loading in a shell scripting like class loading in java

Like class loader in java, can we make a function loader in shell script, for this can someone throw some light on how internally bash runs a shell script , what happenes in runtime ... thanks in advance.. (1 Reply)
Discussion started by: mpsc_sela
1 Replies

3. Shell Programming and Scripting

Scope of exported function

Hi I'm hoping someone can tell me how to extend the scope of an exported function in the korn shell. I have written a function in a file that I dot in from my .kshrc file and it works fine. However I would like this function to be available to anyone in a certain group on the machine... (10 Replies)
Discussion started by: steadyonabix
10 Replies

4. Shell Programming and Scripting

Help needed on Associative array in awk

Hi All, I got stuck up with shell script where i use awk. The scenario which i am working on is as below. I have a file text.txt with contents COL1 COL2 COL3 COL4 1 A 500 400 1 B 500 400 1 A 500 200 2 A 290 300 2 B 290 280 3 C 100 100 I could able to sum col 3 and col4 based on... (3 Replies)
Discussion started by: imsularif
3 Replies

5. Shell Programming and Scripting

Associative array

I have an associative array named table declare -A table table="fruit" table="veggie" table="GT" table="eminem" Now say I have a variable returning the value highway How do I find corresponding value GT ?? (this value that I find (GT in this case) is supposed to be the name of a mysql... (1 Reply)
Discussion started by: leghorn
1 Replies

6. Shell Programming and Scripting

Associative Array with more than one item per entry

Hi all I have a problem where i have a large list ( up to 1000 of items) and need to have 2 items pulled from it into variables in a bash script my list is like the following and I could have it as an array or possibly an external text file maintained separately. Every line is different and... (6 Replies)
Discussion started by: kcpoole
6 Replies

7. Shell Programming and Scripting

Morse Code with Associative Array

Continuing my quest to learn BASH, Bourne, Awk, Grep, etc. on my own through the use of a few books. I've come to an exercise that has me absolutely stumped. The specifics: 1. Using ONLY BASH scripting commands (not sed, awk, etc.), write a script to convert a string on the command line to... (22 Replies)
Discussion started by: ksmarine1980
22 Replies

8. Shell Programming and Scripting

Using associative array for comparison

Hello together, i make something wrong... I want an array that contains information to associate it for further processing. Here is something from my bash... You will know, what I'm trying to do. I have to point out in advance, that the variable $SYSOS is changing and not as static as in my... (2 Replies)
Discussion started by: Decstasy
2 Replies

9. Shell Programming and Scripting

Associative array index question

I am trying to assign indexes to an associative array in a for loop but I have to use an eval command to make it work, this doesn't seem correct I don't have to do this with regular arrays For example, the following assignment fails without the eval command: #! /bin/bash read -d "\0" -a... (19 Replies)
Discussion started by: Riker1204
19 Replies

10. UNIX for Beginners Questions & Answers

Sudo has no access to exported bash function

Hello. I am running leap 15.1 sudo behavior may differ from other distrib. I have a file with functions definition .... function_1 { echo "Hello world" } export -f function_1 This file is sourced by both /etc/bash.bashrc.local and profile.local. So the functions are... (3 Replies)
Discussion started by: jcdole
3 Replies
SOAPCLIENT.__SOAPCALL(3)						 1						  SOAPCLIENT.__SOAPCALL(3)

SoapClient::__soapCall - Calls a SOAP function

SYNOPSIS
public mixed SoapClient::__soapCall (string $function_name, array $arguments, [array $options], [mixed $input_headers], [array &$out- put_headers]) DESCRIPTION
This is a low level API function that is used to make a SOAP call. Usually, in WSDL mode, SOAP functions can be called as methods of the SoapClient object. This method is useful in non-WSDL mode when soapaction is unknown, uri differs from the default or when sending and/or receiving SOAP Headers. On error, a call to a SOAP function can cause PHP to throw exceptions or return a SoapFault object if exceptions are disabled. To check if the function call failed to catch the SoapFault exceptions, check the result with is_soap_fault(3). PARAMETERS
o $function_name - The name of the SOAP function to call. o $arguments - An array of the arguments to pass to the function. This can be either an ordered or an associative array. Note that most SOAP servers require parameter names to be provided, in which case this must be an associative array. o $options - An associative array of options to pass to the client. The location option is the URL of the remote Web service. The uri option is the target namespace of the SOAP service. The soapaction option is the action to call. o $input_headers - An array of headers to be sent along with the SOAP request. o $output_headers - If supplied, this array will be filled with the headers from the SOAP response. RETURN VALUES
SOAP functions may return one, or multiple values. If only one value is returned by the SOAP function, the return value of __soapCall will be a simple value (e.g. an integer, a string, etc). If multiple values are returned, __soapCall will return an associative array of named output parameters. On error, if the SoapClient object was constructed with the exceptions option set to FALSE, a SoapFault object will be returned. EXAMPLES
Example #1 SoapClient.__soapCall(3) example <?php $client = new SoapClient("some.wsdl"); $client->SomeFunction($a, $b, $c); $client->__soapCall("SomeFunction", array($a, $b, $c)); $client->__soapCall("SomeFunction", array($a, $b, $c), NULL, new SoapHeader(), $output_headers); $client = new SoapClient(null, array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client->SomeFunction($a, $b, $c); $client->__soapCall("SomeFunction", array($a, $b, $c)); $client->__soapCall("SomeFunction", array($a, $b, $c), array('soapaction' => 'some_action', 'uri' => 'some_uri')); ?> SEE ALSO
SoapClient::SoapClient, SoapParam::SoapParam, SoapVar::SoapVar, SoapHeader::SoapHeader, SoapFault::SoapFault, is_soap_fault(3). PHP Documentation Group SOAPCLIENT.__SOAPCALL(3)
All times are GMT -4. The time now is 11:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy