Hi
I have a doubt in the way the variables inside a function are treated .
if a function is called from the main script directly, the variables inside them act as global variables.
however if the return value of the function is stored to some other variable in the main script as shown,... (3 Replies)
Hi all,
I'm doing automation task for my team and I just started to learn unix scripting so please shed some light on how to do this:
1) I have 2 sets of datafiles - datafile A and B. These datafiles must be loaded subsequently and cannot be loaded concurrently.
2) So I loaded datafile A... (10 Replies)
I have write a shell function to get the maximum of a vector.
However, the returned value from the function is not always
the correct one.
Here is the script:
maxval()
{
local max j i size arrval
size=$1 ; shift
max=-999999999
i=0
while
do
arrval="$1"
if
then
... (5 Replies)
What I need to learn is how to use a script that launches background processes, and then kills those processes as needed.
The script successfully launches the script. But how do I check to see if the job exists before I kill it?
I know my problem is mostly failure to understand parameter... (4 Replies)
Hi,
I have created a function f1 defined in script A.sh .I have called this function in background . But I want to use its return value for another function f2 in script A.sh.
I tried declaring it as a global variable, yet it always returns the status as 0. Is there any way with which I can get... (7 Replies)
Not sure where the problem is. I can run the script without any issue using the following command.
. /opt/app/scripts/cdc_migration.sh
But it fails with the below error when I try it this way
/opt/app/scripts/cdc_migration.sh
/opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Hi All,
Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition.
#Body
function1()
{
if
then
echo "exist"
else
echo "not exist"
}
#if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
LEARN ABOUT REDHAT
clock
CLOCK(3) Linux Programmer's Manual CLOCK(3)NAME
clock - Determine processor time
SYNOPSIS
#include <time.h>
clock_t clock(void);
DESCRIPTION
The clock() function returns an approximation of processor time used by the program.
RETURN VALUE
The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, divide by CLOCKS_PER_SEC. If the processor
time used is not available or its value cannot be represented, the function returns the value (clock_t)-1.
CONFORMING TO
ANSI C. POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the actual resolution.
NOTES
The C standard allows for arbitrary values at the start of the program; subtract the value returned from a call to clock() at the start of
the program to get maximum portability.
Note that the time can wrap around. On a 32bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value approx-
imately every 72 minutes.
On several other implementations, the value returned by clock() also includes the times of any children whose status has been collected via
wait() (or another wait-type call). Linux does not include the times of waited-for children in the value returned by clock(). The times()
function, which explicitly returns (separate) information about the caller and its children, may be preferable.
SEE ALSO getrusage(2), times(2)GNU 2002-06-14 CLOCK(3)