02-19-2007
Resolved
Ya ,
i was able to pass the global variable to the function .
Sorry for that dumb question .
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Is it possible to pass a variable name, as a parameter to a function, so it can be created within this function ?
Something like this:
func_uppercase abcdefgh var_name
where the 1st parameter is the string I want to convert and the 2nd is the desired variable name...
$2=`echo "$1" |... (2 Replies)
Discussion started by: 435 Gavea
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I am trying to sum up numbered columns and in order to tidy up the program I have wrote a function to do the adding of some numbers. I have a problem though with passing a variable to the function in the UNIX bash shell. The function only gives the first number in the variable list and does... (4 Replies)
Discussion started by: Knotty
4 Replies
3. UNIX for Advanced & Expert Users
Suppose I have a unix variable called RGNM which is holding a value. Now I want to call a plsql function in my script. THis plsql function takes one IN parameter. I want to pass my UNIX VARIABLE Value to the plsql function. Can i just give it by giving $RGNM in the function after calling sqlplus... (1 Reply)
Discussion started by: cobroraj
1 Replies
4. UNIX for Dummies Questions & Answers
I would like to know how to pass a variable inside a variable to a function.
sample code below
--------------
for x in 1 9
do
check_null $C$x ##call function to check if the value is null
if
then
echo "line number:$var_cnt,... (2 Replies)
Discussion started by: KingVikram
2 Replies
5. Shell Programming and Scripting
I have two scripts. script1.sh looks
--------------------------------
#!/bin/bash
display()
{
echo "Welcome to Unix"
}
display
-----------------------------
Script2.sh
#!/bin/bash
sh script1.sh //simply calling script1.sh
------------------------------ (1 Reply)
Discussion started by: mvictorvijayan
1 Replies
6. Shell Programming and Scripting
following on from below link
https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569
i will be using file reading in while loop say for example
while read line123
do
echo "line read is $line123"
insert_funct $line123
done< mysqldump.sql... (6 Replies)
Discussion started by: vivek d r
6 Replies
7. Shell Programming and Scripting
emailid=myemail@xyz.com
taskName="DB-Backup"
starttime=`date`
email()
{
subject="$taskName" ": " $* " at `date` "
mutt -s "$subject" $emailid < /dev/null
}
email "Starting"
#do my stuff
email "Finished"
The above code gives following error
./dbbackup.sh: line 6: :... (5 Replies)
Discussion started by: nitiraj.rathore
5 Replies
8. Shell Programming and Scripting
Hello All,
I would like to ask help from you on how to pass variable value from a function that has been called inside the function. I have created below and
put the variables in " ". Is there another way I can do this? Thank you in advance.
readtasklist() {
while read -r mod ver... (1 Reply)
Discussion started by: aderamos12
1 Replies
9. Shell Programming and Scripting
I have the below script which creates a directory or simply terminates without throwing error (exit 1) incase the directory exists.
bash-4.1$ vi mdir.sh
#!/bin/bash -e
shopt -s expand_aliases
alias mkdir=mkdir_s
mkdir_s(){
if ]; then
echo " directory EXISTS "
return
else
echo "... (3 Replies)
Discussion started by: mohtashims
3 Replies
10. Shell Programming and Scripting
I want to make a config file which contain all the paths.
i want to read the config file line by line and pass as an argument on my below function.
Replace all the path with reading config path line by line and pass in respective functions.
how can i achieve that?
Kindly guide.
... (6 Replies)
Discussion started by: sadique.manzar
6 Replies
timeout(9r) timeout(9r)
NAME
timeout - General: Initializes a callout queue element
SYNOPSIS
void timeout(
int (*function) (),
caddr_t argument,
register int time );
ARGUMENTS
Specifies a pointer to the routine to be called. Specifies a single argument to be passed to the called routine. Specifies the amount of
time to delay before calling the specified routine. You express time as time (in seconds) * hz.
DESCRIPTION
The timeout routine initializes a callout queue element to make it easy to execute the specified routine at the time specified in the time
argument. You often use callout routines for infrequent polling or error handling. The routine you specify will be called on the interrupt
stack (not in processor context) as dispatched from the softclock routine.
The global variable hz contains the number of clock ticks per second. This variable is a second's worth of clock ticks.
Thus, if you wanted a 4-minute timeout, you would pass 4 * 60 * hz as the third argument to the timeout routine as follows:
/* A 4-minute timeout */
.
.
.
timeout(lptout, (caddr_t)dev, 4 * 60 * hz);
NOTES
The granularity of the time delay is dependent on the hardware. For example, the granularity of some Alpha CPUs is 1024 clock ticks per
second. Other Alpha CPUs have a granularity of 1200 clock ticks per second. Still other Alpha CPUs exhibit a granularity of 128 clock
ticks per second. Because the granularity of the time delay is dependent on the hardware, the operating system provides the hz and lbolt
global variables. Use the hz global variable to determine the number of clock ticks per second for a specific Alpha CPU. Use the lbolt
global variable as a periodic wakeup mechanism.
RETURN VALUES
None
SEE ALSO
Routines: untimeout(9r)
timeout(9r)