Sponsored Content
Top Forums Shell Programming and Scripting How to export a variable from a child process running in background to the parent Post 302258218 by demwz on Friday 14th of November 2008 04:35:55 AM
Old 11-14-2008
exported variables are inherited from parent to child and not the other way round.
Tough there is always a way shell ist not designed to do inter Process communication (IPC) this is normaly done by shared memory access or Unix domain sockets.
your example is quite simple bcs the child ends very fast.
echo $(./child.sh)
but if you want to acces data from a running child it gets complicated.
you may let the child write to a file or fifo which is read by the parrent.
 

10 More Discussions You Might Find Interesting

1. Solaris

how to capture oracle export log while running as background process

I ran the Oracle 9i export command from a terminal to export out a big table using "exp andrew/password file=andrew.dmp log=andrew.log" From the terminal I can see that the export is running as there is some output from the oracle export job. The export job is not complete yet. When i go check... (4 Replies)
Discussion started by: hippo2020
4 Replies

2. UNIX for Advanced & Expert Users

how to make a parent wait on a child shells running in background?

Hi I have a shell script A which calls another 10 shell scripts which run in background. How do i make the parent script wait for the child scripts complete, or in other words, i must be able to do a grep of parent script to find out if the child scripts are still running. My Code: ... (1 Reply)
Discussion started by: albertashish
1 Replies

3. UNIX for Advanced & Expert Users

send a new value to a variable in a running background process

Hi guys, I have a issue with a background process, I need to update the value of a variable in that process which is running at this time and it will be running for at least 2 days. Any idea? I will apreciate your help. regards. Razziel. (2 Replies)
Discussion started by: razziel
2 Replies

4. Shell Programming and Scripting

How to make the parent process to wait for the child process

Hi All, I have two ksh script. 1st script calls the 2nd script and the second script calls an 'C' program. I want 1st script to wait until the 'C' program completes. I cant able to get the process id for the 'C' program (child process) to make the 1st script to wait for the second... (7 Replies)
Discussion started by: sennidurai
7 Replies

5. Shell Programming and Scripting

Makefile: Parent - Child Inheritance and export

Hi, I have a number of Makefiles, including a couple of files that I include in Makefiles, a few scripts that are executed through Makefiles, and I have problems with environment variables that are not inherited to the scripts properly. Simplified scenario: rootdir/Makefile: all: ... (1 Reply)
Discussion started by: Shompis
1 Replies

6. Shell Programming and Scripting

[KSH/Bash] Starting a parent process from a child process?

Hey all, I need to launch a script from within 2 other scripts that can run independently of the two parent scripts... Im having a hard time doing this, if anyone knows how please let me know. More detail. ScriptA (bash), ScriptB (ksh), ScriptC (bash) ScriptA, launches ScriptB ScirptB,... (7 Replies)
Discussion started by: trey85stang
7 Replies

7. Shell Programming and Scripting

Export variable, as a background process

Have a script where I need to wait for a process to run, but from that process I want to capture the row count. Script I have so far (easier than explanation): echo "Start" export NUMROWS=`td "select * from dbc.database" 2> /dev/null | grep "Query completed" | sed -e 's/.*Query... (7 Replies)
Discussion started by: Cranie
7 Replies

8. Shell Programming and Scripting

forking a child process and kill its parent to show that child process has init() as its parent

Hi everyone i am very new to linux , working on bash shell. I am trying to solve the given problem 1. Create a process and then create children using fork 2. Check the Status of the application for successful running. 3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies

9. Shell Programming and Scripting

Export variable to another script running in background

i have a script inside which i have generated a background job which will run another script. How do i export the variables from parent script to the child script which wil run in the background . a.sh:- export tmpdir="/usr/tmp" nohup b.sh& b.sh:- echo $tmpdir But... (1 Reply)
Discussion started by: millan
1 Replies

10. UNIX for Advanced & Expert Users

Issue with tracking successful completion of Child process running in background

Hello All, I am using Linux. I have two scripts: inner_script.ksh main_wrapper_calling_inner.ksh Below is the code snippet of the main_wrapper_calling_inner.ksh: #!/bin/ksh ppids=() ---> Main array for process ids. fppids=() ---> array to capture failed process ids. pcnt=0 --->... (5 Replies)
Discussion started by: dmukherjee
5 Replies
show child(1m)															    show child(1m)

NAME
show child - Displays attribute information about the specified child pointer SYNOPSIS
cdscp show child child-name [attribute-name] [with attribute-name = attribute-value] ARGUMENTS
The full name of a specific child pointer. The last simple name can contain wildcard characters. The name of an attribute; see Descrip- tion for valid attribute names. The value of a particular attribute. DESCRIPTION
The show child command displays the names and values of the attributes specified in attribute-name. You can use a combination of attributes in a single command. Use a space to separate multiple attributes. You can use a with attribute-name = attribute-value clause to limit output only to child pointers whose attributes have values equal to the specified values. A space must precede and follow the = (equals sign). If you do not supply any attributes, the command displays all attributes and their values. The following is a description of child pointer attributes: Specifies the creation timestamp (CTS) of the specified child pointer. Specifies the unique identifier of the directory to which the child pointer refers. Specifies the address, UUID, and name of a set of clearinghouses where a copy of the child directory ref- erenced by the child pointer is located. This attribute also specifies whether the directory in a particular clearinghouse is a master or read-only replica. Specifies the timestamp of the most recent update to an attribute of the child pointer. Privilege Required You must have read permission to the child pointer. If you specify a wildcard child name, you also need read permission to the parent directory. NOTE
This command is replaced at Revision 1.1 by the dcecp command and may not be provided in future releases of DCE. EXAMPLE
The following command displays all of the attributes and values of the child directory to which the child pointer /.:/admin refers: cdscp> show child /.:/admin SHOW CHILD /.../abc.com/admin AT 1991-10-15-15:56:01 CDS_CTS = 1991-10-15-19:55:52.000000003/08-00-2b-1c-8f-1f CDS_UTS = 1991-10-15-19:55:52.000000006/08-00-2b-1c-8f-1f CDS_ObjectUUID = 6b5362e8-8b1c-11ca-8981-08002b0f79aa CDS_Replicas = : Clearinghouse's UUID = 2ab024a8-8b1a-11ca-8981-08002b0f79aa Tower = ncadg_ip_udp:16.18.16.32 Tower = ncacn_ip_tcp:16.18.16.32 Replica type = master Clearinghouse's Name = /.../abc.com/Boston_CH RELATED INFORMATION
Commands: create child(1m), delete child(1m), list child(1m) show child(1m)
All times are GMT -4. The time now is 07:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy