09-26-2013
Quote:
Originally Posted by
periyasamycse
Hi,
Have assigned values in Array and iterating in while loop and would require values outside of the loop. But its returning NULL.
could you please help us how to define Global array declaration in Unix shell scripting?
i am using Kron shell.
Thanks in advance.
I assume you mean that you're using the Korn shell.
If your array assignments are happening in a subshell environment, the values assigned will not be seen in the original shell environment. (If this is the case sea's suggestion won't help.)
Without seeing your code, we can only waste time guessing at what might be wrong. Please show us your code, explain what you want that code to do, show us the output you want, and show us the output you are getting (including all diagnostic messages). Please also tell us what type of system you're using. (The utilities available and the options available for those utilities varies from system to system.)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am just stucked in syntax.This is more like a array and for loop problem.
I want to use ls -l command and get filezise and filename of all filenames in the directory in an array (say array#1).
After 2 minutes of sleep, i want to get the same information in another array (say array#2).
The... (4 Replies)
Discussion started by: 33junaid
4 Replies
2. Shell Programming and Scripting
Hi all,
How to print variable value which i have assigned inside for loop
because that variable scope is local, but i want to use that variable outside for loop.
Awaiting your great help
Thanks,
Susil (1 Reply)
Discussion started by: susilgandhi
1 Replies
3. Solaris
Dear all,
i m unable to give array decalartion in solaris Operating system shell script
and script was so.sh
declare -a bull
for i in 1 2 3 4 5 6 7 8 9
do
bull=$i
echo "${bull}"
done
it is throwing an error called
so.sh: declare: not found
so.sh: bull=1: not... (20 Replies)
Discussion started by: naree
20 Replies
4. Shell Programming and Scripting
Hi,
I am using shell (#!/bin/bash), i am trying to set my date in a script date.sh, i want this dates to be used by another scripts.
I have tried to make:
#!/bin/bash
begin_date =`date +%Y_%m_%d_%H_%M_%S`,
i also tried:
#!/bin/bash
begin_date =20080709 12:14:11, then i write in... (11 Replies)
Discussion started by: rosalinda
11 Replies
5. UNIX for Dummies Questions & Answers
Hi all,
I would like to declare a vector of variables and access them sequentially.
Here is my code
ARRAY_CT="0001000000 0000100000 0000010000"
ELEMENTS_CT=${#ARRAY_CT}
echo $ELEMENTS_CT
for (( j=1;j<=$ELEMENTS_IS;j++)); do
echo ${ARRAY_IS}
done
... (2 Replies)
Discussion started by: f_o_555
2 Replies
6. Solaris
Hi Guys,
My requirement is I have file called /opt/orahome/.profile in non global zone.
PATH=/usr/bin:/usr/ucb:/etc:/usr/sbin:/usr/local/bin:/usr/openwin/bin:.
export PATH
PS1="\${ORACLE_SID}:`hostname`:\$PWD$ "
export PS1
EDITOR=vi
export EDITOR
ENV=/opt/orahome/.kshrc
export ENV... (1 Reply)
Discussion started by: vijaysachin
1 Replies
7. Shell Programming and Scripting
this is my code
declare -a USERCERT
declare -a CACERT
declare -a KEYSRC
this is the error
+ declare -a USERCERT
./clone.sh: 1: declare: not found
+ declare -a CACERT
./clone.sh: 1: declare: not found
+ declare -a KEYSRC
./clone.sh: 1: declare: not found (11 Replies)
Discussion started by: xerox
11 Replies
8. Shell Programming and Scripting
Hello All,
Can you please help me with the below.
#!/bin/bash
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1"
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5... (14 Replies)
Discussion started by: Ariean
14 Replies
9. Solaris
hi all,
Just a simple question but i cant get the answers in the book -
In my globalzone , assuming i have 4 cpus (psrinfo -pv = 0-3), if i set dedicated-cpu (ncpus=2) for my local zone
Is my globalzone left with 2 cpus or still 4 cpus ? Does localzone "resource reservation.e.g. cpu in... (6 Replies)
Discussion started by: javanoob
6 Replies
10. Shell Programming and Scripting
Hello.
During startup /etc/bash.bashrc.local generates some array
.....
source /.../.../system_common_general_array_env_var
.....
The file system_common_general_array_env_var contains :
LEAP_VERSION='42.3'
ARRAY_MAIN_REPO_LEAP=('zypper_local' 'openSUSE-Leap-'"$LEAP_VERSION"'-Non-Oss' ... (2 Replies)
Discussion started by: jcdole
2 Replies
LEARN ABOUT LINUX
erl_global
erl_global(3erl) C Library Functions erl_global(3erl)
NAME
erl_global - Access globally registered names
DESCRIPTION
This module provides support for registering, looking up and unregistering names in the Erlang Global module. For more information, see the
description of Global in the reference manual.
Note that the functions below perform an RPC using an open file descriptor provided by the caller. This file descriptor must not be used
for other traffic during the global operation or the function may receive unexpected data and fail.
EXPORTS
char ** erl_global_names(fd,count)
Types int fd;
int *count;
Retrieve a list of all known global names.
fd is an open descriptor to an Erlang connection.
count is the address of an integer, or NULL. If count is not NULL, it will be set by the function to the number of names found.
On success, the function returns an array of strings, each containing a single registered name, and sets count to the number of
names found. The array is terminated by a single NULL pointer. On failure, the function returns NULL and count is not modified.
Note:
It is the caller's responsibility to free the array afterwards. It has been allocated by the function with a single call to malloc() , so a
single free() is all that is necessary.
int erl_global_register(fd,name,pid)
Types int fd;
const char *name;
ETERM *pid;
This function registers a name in Global.
fd is an open descriptor to an Erlang connection.
name is the name to register in Global.
pid is the pid that should be associated with name . This is the value that Global will return when processes request the location
of name .
The function returns 0 on success, or -1 on failure.
int erl_global_unregister(fd,name)
Types int fd;
const char *name;
This function unregisters a name from Global.
fd is an open descriptor to an Erlang connection.
name is the name to unregister from Global.
The function returns 0 on success, or -1 on failure.
ETERM * erl_global_whereis(fd,name,node)
Types int fd;
const char *name;
char *node;
fd is an open descriptor to an Erlang connection.
name is the name that is to be looked up in Global.
If node is not NULL, it is a pointer to a buffer where the function can fill in the name of the node where name is found. node can
be passed directly to erl_connect() if necessary.
On success, the function returns an Erlang Pid containing the address of the given name, and node will be initialized to the node-
name where name is found. On failure NULL will be returned and node will not be modified.
Ericsson AB erl_interface 3.7.3 erl_global(3erl)