I don't think that you can do that through a command. May be something like this?
Here test.sh holds the global function, test1.sh 'sources' test.sh via the '. ./' mechanism.
Note: on Solaris, please use nawk instead of awk.
Last edited by blowtorch; 05-31-2006 at 01:12 PM..
Reason: adding Solaris note
I don't follow what these are...
this is what my text says...
"When a process is started, a duplicate of that process is created. This new process is called the child and the process that created it is called the parent. The child process then replaces the copy for the code the parent... (1 Reply)
:(
Since I'm fairly new to the scene and don't have much experience in shell programming, I decided to check out the net for a useful script or two.
What I'm looking for is a script that would let me enter a PID and then show the process tree associated with it.
So it would display the (grand-)... (2 Replies)
Hello all,
I have gone through the search and looked at posting about idle users and killing processes. Here is my question I would like to kill an idle user ( which I can do) but how can I asure that all of his process is also killed whit out tracing his inital start PID. I have tried this on a... (4 Replies)
Hi
I am trying to see if there are some options in ps command or if there is a shell script which basically shows you all the processes spawned by a parent process , then all the processes of its child processes and so on down the hierarchy may be like a tree structure. It might be a generic... (6 Replies)
Consider this simple command line
bash -c 'echo $$ ; sleep 10000'This will print the newly created bash PID and sleep for a long time.
If I go to another terminal and do something like
ps -flax | grep leepI'll see something like
501 92418 91910 0 0:00.00 ttys000 0:00.00 bash -c echo $$... (5 Replies)
Hello,
I am trying to create a pipe that will direct stdout to in side of the pipe, and stdin to the out side of the pipe - I created two child processes to handle this. However, my pipe doesn't seem to be working correctly. Did I use execv() correctly? Command1 and command2 represent the two... (3 Replies)
1. The problem statement, all variables and given/known data:
I need to make an program that in a loop creates one parent and five children with fork(). The problem i'm trying to solve is how to delete the parent and child of the childīs process.
2. Relevant commands, code, scripts,... (0 Replies)
Hi friends,
I have a small question regarding unix system call fork, I hope you will solve my problem. Here is the small program
$ cat fork1.c
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
int pid;
int x = 0;
x = x + 1;
pid = fork();
if(pid < 0)
{... (2 Replies)
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)
I am trying to kill PIDs that are tied to a KSH "load_sqlplus" and I am using the below code
LIST_PID=`ps -ef | grep -i "load_sqlplus" | grep -v grep | awk '{print $2}'`
if ; then
echo "Processes killed" "PID : " $LIST_PID
kill -9 $LIST_PID
else
echo "Nothing to Kill"
fi... (4 Replies)
Discussion started by: venky338
4 Replies
LEARN ABOUT SUSE
autouse
autouse(3pm) Perl Programmers Reference Guide autouse(3pm)NAME
autouse - postpone load of modules until a function is used
SYNOPSIS
use autouse 'Carp' => qw(carp croak);
carp "this carp was predeclared and autoused ";
DESCRIPTION
If the module "Module" is already loaded, then the declaration
use autouse 'Module' => qw(func1 func2($;$));
is equivalent to
use Module qw(func1 func2);
if "Module" defines func2() with prototype "($;$)", and func1() has no prototypes. (At least if "Module" uses "Exporter"'s "import",
otherwise it is a fatal error.)
If the module "Module" is not loaded yet, then the above declaration declares functions func1() and func2() in the current package. When
these functions are called, they load the package "Module" if needed, and substitute themselves with the correct definitions.
WARNING
Using "autouse" will move important steps of your program's execution from compile time to runtime. This can
o Break the execution of your program if the module you "autouse"d has some initialization which it expects to be done early.
o hide bugs in your code since important checks (like correctness of prototypes) is moved from compile time to runtime. In particular,
if the prototype you specified on "autouse" line is wrong, you will not find it out until the corresponding function is executed. This
will be very unfortunate for functions which are not always called (note that for such functions "autouse"ing gives biggest win, for a
workaround see below).
To alleviate the second problem (partially) it is advised to write your scripts like this:
use Module;
use autouse Module => qw(carp($) croak(&$));
carp "this carp was predeclared and autoused ";
The first line ensures that the errors in your argument specification are found early. When you ship your application you should comment
out the first line, since it makes the second one useless.
AUTHOR
Ilya Zakharevich (ilya@math.ohio-state.edu)
SEE ALSO perl(1).
perl v5.12.1 2010-04-26 autouse(3pm)