May i know how to pass an argument to a function in a shell script?
Sorry, i din stated that it is in a shell script in my previous post.
Means: checkStatus() {
...........
}
read status;
I wanna use the status in the function checkstatus, how... (2 Replies)
I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in.
How can I make the function receive the whole string (and not terminate at the first space it encounters)?.
part of... (1 Reply)
I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in.
How can I make the function receive the whole string (and not terminate at the first space it encounters)?.
part of... (2 Replies)
Hello all
im trying to build function that will return void function pointer
what is mean is ( not working )
the main function
void * myClass::getFunction(int type){
if(type==1)
return &myClass::Test1;
if(type==2)
return &myClass::Test2;
}
void myClass::Test1(){... (1 Reply)
Hi All,
Calling a function with one argument and storing the return value in a shell script is as below:( so far I know)
value="`fun_1 "argument1"`"
Its working perfectly for me.
Can u help me with passing more than one argument and storing the return value
Thnaks in advance
JS (1 Reply)
Hi,
I have 2 ksh scripts.
Script1.ksh contains function definition.
script1.ksh
function f1() {
while getopts a:c: args
do
case $args in
a) ARG1=$OPTARG ;;
c) ARG2=$OPTARG ;;
\?) echo "Error no valid Arguments passed"
esac
done
echo $ARG1
echo $ARG2
script2.sh (2 Replies)
Hi,
I have a function which connects to the db and runs the sql.
it works fine when I run it like: function "select empname from emp;"
but when I try to pass the sql string to a variable which in turn in fed to the function , it throws error.
please advise.
Thanks,
Arnie. (1 Reply)
Hi all,
In the given script code .
I want to pass the maximum value that variable "i" will have in function DivideJobs () to variable $max of function SubmitCondorJob().
Any help?
Thanks
#!/bin/bash ... (55 Replies)
i am passing input parameter 'one_two' to the script , the script output should display the result as below
one_1two
one_2two
one_3two
if
then
echo " Usage : <$0> <DATABASE> "
exit 0
else
for DB in 1 2 3
do
DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}`
done
fi (5 Replies)
Hi All,
Just trying to implement the below shell script using AIX ksh shell.
myfunc {
eval "$*"
}
CMD='ls -la /etc/hosts | awk '{print $9"|"$5}''
myfunc $CMD
Keeping getting "|}: not found" errors, any pointers would greatly be appreciated.
Kind Regards
Ed
Please... (2 Replies)
Discussion started by: eo29
2 Replies
LEARN ABOUT DEBIAN
putctl
putctl(9F) Kernel Functions for Drivers putctl(9F)NAME
putctl - send a control message to a queue
SYNOPSIS
#include <sys/stream.h>
int putctl(queue_t *q, int type);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
q Queue to which the message is to be sent.
type Message type (must be control, not data type).
DESCRIPTION
putctl() tests the type argument to make sure a data type has not been specified, and then attempts to allocate a message block. putctl()
fails if type is M_DATA, M_PROTO, or M_PCPROTO, or if a message block cannot be allocated. If successful, putctl() calls the put(9E)
routine of the queue pointed to by q with the newly allocated and initialized messages.
RETURN VALUES
On success, 1 is returned. If type is a data type, or if a message block cannot be allocated, 0 is returned.
CONTEXT
putctl() can be called from user or interrupt context.
EXAMPLES
Example 1: Using putctl()
The send_ctl() routine is used to pass control messages downstream. M_BREAK messages are handled with putctl() (line 11). putctl1(9F)
(line 16) is used for M_DELAY messages, so that parm can be used to specify the length of the delay. In either case, if a message block
cannot be allocated a variable recording the number of allocation failures
is incremented (lines 12, 17). If an invalid message type is detected, cmn_err(9F) panics the system (line 21).
1 void
2 send_ctl(wrq, type, parm)
3 queue_t *wrq;
4 uchar_t type;
5 uchar_t parm;
6 {
7 extern int num_alloc_fail;
8
9 switch (type) {
10 case M_BREAK:
11 if (!putctl(wrq->q_next, M_BREAK))
12 num_alloc_fail++;
13 break;
14
15 case M_DELAY:
16 if (!putctl1(wrq->q_next, M_DELAY, parm))
17 num_alloc_fail++;
18 break;
19
20 default:
21 cmn_err(CE_PANIC, "send_ctl: bad message type passed");
22 break;
23 }
24 }
SEE ALSO put(9E), cmn_err(9F), datamsg(9F), putctl1(9F), putnextctl(9F)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.10 11 Apr 1991 putctl(9F)