11-20-2008
i assume the functions are running in a subshell depending on how you ionvoke them.
The subshell is closed after execution an the variables are lost. export does only work from parent to child.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am using Solaris 8 and I want to change the PATH setting for all users. I have edited /etc/profile, but when I log in and check the PATH variable, it hasn't changed.
Am I missing something? (5 Replies)
Discussion started by: jxh
5 Replies
2. UNIX for Dummies Questions & Answers
hi,
i am a newbie unix administrator. i want to set a variable, let's say :
alias cls 'clear'
But i am not going to add this line in the .login file for every home directory of my 500+ users.
pls tell me where should i put this line in, so that all users can use this variable after... (4 Replies)
Discussion started by: champion
4 Replies
3. Shell Programming and Scripting
Can someone give me "the lecture" on why you shouldn't make all your varables global when programming in perl. I have been doing this but I have heard that it is not a good practice. (3 Replies)
Discussion started by: reggiej
3 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
I know to set global variable i can use export .. But take the situation like below ..
I want to set a variable in one script and access that in second script
i have done like this .. It is not working
one.sh
#!/usr/bin/ksh
echo $RISSHI
export RISSHI=1
two.sh... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I hav created a script that calls a sub-script. In both the scripts i called the configuration file. Now i wanted to use a variable that should be used in both script and sub-script files. Actually, i wanted to return a file name and the return status to the script file from the sub-script.... (6 Replies)
Discussion started by: Swapna173
6 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. UNIX for Advanced & Expert Users
Is there anyway in which i can set a permanent global variable in unix, which when initialised with a value and modified during any shell script, would retain its value even if i logout and login
I dont know whether i am being able to express my need clearly but basically what i want is a... (3 Replies)
Discussion started by: arindamlive
3 Replies
8. UNIX for Dummies Questions & Answers
hi all,
i need a help for the following query.
Thanks in advance for your valuable time.
i have a main.pl file which has a global variable declared as below.
our myVar=0;
call first.pl script from the main.pl script.
print the value of myVar (the value is still 0 and not 10.)
i have a... (1 Reply)
Discussion started by: hemalathak10
1 Replies
9. Shell Programming and Scripting
Hi all,
I want to dynamically set variables in a bash script. I made a naive attempt in a while loop that hopefully can clarify the idea.
n=0; echo "$lst" | while read p; do n=$(($n+1)); p"$n"="$p"; done
The error message is:
bash: p1=line1: command not found
bash: p2=line2: command... (8 Replies)
Discussion started by: jeppe83
8 Replies
10. Shell Programming and Scripting
I have a variable I want to use in bash script. The user will pass an argument
to the script and I will store it in `arg_fql`. If the user does not pass the variable,
I still never set arg_fql, but I set another variable to a default. However, if the user
passes a value, `arg_fql` will be set to... (2 Replies)
Discussion started by: kristinu
2 Replies
vfork(2) System Calls Manual vfork(2)
NAME
vfork - spawn new process; share virtual memory
SYNOPSIS
REMARKS
is a higher performance version of that is provided on some systems where a performance advantage can be attained.
If the calling process is multi-threaded, the newly created child process will only contain one thread. This one thread will be a copy of
the thread calling
differs from only in that the child process can share code and data with the calling process (parent process). This speeds cloning activ-
ity significantly at a risk to the integrity of the parent process if is misused.
The use of for any purpose except as a prelude to an immediate or is not supported. Any program that relies upon the differences between
and is not portable across HP-UX systems.
All HP-UX implementations must provide the entry but it is permissible for them to treat it identically to On some implementations the two
are not distinguished because the implementation is as efficient as possible. Other versions may do the same to avoid the overhead of sup-
porting two similar calls.
DESCRIPTION
can be used to create new processes without fully copying the address space of the old process. If a forked process is simply going to do
an (see exec(2)), the data space copied from the parent to the child by is not used. This is particularly inefficient in a paged environ-
ment, making particularly useful. Depending upon the size of the parent's data space, can give a significant performance improvement over
differs from in that the child borrows the parent's memory and thread of control until a call to or an exit (either by a call to or abnor-
mally (see exec(2) and exit(2)). The parent process is suspended while the child is using its resources.
returns 0 in the child's context and (later) the pid of the child in the parent's context.
can normally be used just like It does not work, however, to return while running in the child's context from the procedure which called
since the eventual return from would then return to a no longer existent stack frame.
The window begins at the call and ends when the child completes its call.
RETURN VALUE
Upon successful completion, returns a value of 0 to the child process and returns the process ID of the child process to the parent
process. Otherwise, a value of -1 is returned to the parent, no child process is created, and is set to indicate the error.
ERRORS
fails and no child process is created if any of the following conditions are encountered:
The system-wide limit on the total number of processes under execution
would be exceeded.
The system-imposed limit on the total number of processes under execution
by a single user would be exceeded.
DEPENDENCIES
Servers
Process times for the parent and child processes within the window may be inaccurate.
Parent and child processes share the same stack space within the window. If the size of the stack has been changed within this win-
dow by the child process (return from or call to a function, for example), it is likely that the parent and child processes will be
killed with signal or
In the window, a call to (see signal(2) that installs a catching function can affect handling of the signal by the parent. The par-
ent is not affected if the handling is being set to or or if is used (see sigaction(2)).
AUTHOR
was developed by the University of California, Berkeley.
SEE ALSO
exec(2), exit(2), fork(2), sigaction(2), wait(2).
vfork(2)