10-18-2006
How to get system() function executed cmd return value ?
Hi,
How I can get system function executed command return value ? I want to know mv command success or not ?
#include <stdio.h>
main()
{
int ret;
ret = system( "mv x.dat y.dat" );
printf( "system ret:[%d]\n", ret );
}
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
perl 5.6.1:
when i try a "system" command(with if loops for $?), i get this:
child exited with value 1
what is meant by this $? values and what does it meant if it returns 1?.. (0 Replies)
Discussion started by: sekar sundaram
0 Replies
2. Solaris
Hi Friends,
I am trying to execute rsh commands from Solaris 10 system to AIX system.
When I give;
Solaris10# rsh <hostname> ls -l , it gives me an error
rshd : 0826-826 The host name for your address is not known
At the same time,
Solaris10# rsh <hostname> ---- gives me remote shell of... (25 Replies)
Discussion started by: jumadhiya
25 Replies
3. Shell Programming and Scripting
hello All,
I need to invoke by perl script some program/command and monitor it for 5
minutes . In case it still running for more then 5 min I need to send a signal which will stop it.
I implemeted this as shown below by using eval & alarm
and I'd like to know if there is a better way to... (1 Reply)
Discussion started by: Alalush
1 Replies
4. Shell Programming and Scripting
In shell we can find the status of last executed command by $?
In perl what is the command to find the status of last executed command...
Can any one please say???????????????
Thanks,
Prabhu (1 Reply)
Discussion started by: prsampath
1 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
How to do I get the return code of a subroutine in a perl module if invoke the subroutine as standalone,
I have an module say TestExit.pm and in that i have a subroutine say myTest() which is returns 12, if i were to call the subroutine from
command line like
CASE:1 ( Without an explict... (2 Replies)
Discussion started by: ennstate
2 Replies
7. Shell Programming and Scripting
Hi
I would like to ask about my plan script
I have this several workstation want to monitor and execute a command without logging it we use "rsh $host "<command>" i create csh script using foreach to loop my several workstation, my problem with the rsh command is if it encounter a... (3 Replies)
Discussion started by: jao_madn
3 Replies
8. Programming
In gdb, I can call one function with command "call", but how can I step in the function? I don't want to restart the program, but the function had been executed, gdb will execute next statement, and I don't know how to recall the function. (4 Replies)
Discussion started by: 915086731
4 Replies
9. Shell Programming and Scripting
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)
Discussion started by: svajhala
1 Replies
10. Shell Programming and Scripting
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 CENTOS
papi_get_thr_specific
PAPI_get_thr_specific(3) PAPI PAPI_get_thr_specific(3)
NAME
PAPI_get_thr_specific -
Retrieve a pointer to a thread specific data structure.
SYNOPSIS
Detailed Description
@par Prototype:
int PAPI_get_thr_specific( int tag, void **ptr );
@param tag
An identifier, the value of which is either PAPI_USR1_TLS or
PAPI_USR2_TLS. This identifier indicates which of several data
structures associated with this thread is to be accessed.
@param ptr
A pointer to the memory containing the data structure.
@retval PAPI_OK
@retval PAPI_EINVAL
The @em tag argument is out of range.
In C, PAPI_get_thr_specific PAPI_get_thr_specific will retrieve the pointer from the array with index @em tag.
There are 2 user available locations and @em tag can be either
PAPI_USR1_TLS or PAPI_USR2_TLS.
The array mentioned above is managed by PAPI and allocated to each
thread which has called PAPI_thread_init.
There is no Fortran equivalent function.
@par Example:
int ret;
HighLevelInfo *state = NULL;
ret = PAPI_thread_init(pthread_self);
if (ret != PAPI_OK) handle_error(ret);
// Do we have the thread specific data setup yet?
ret = PAPI_get_thr_specific(PAPI_USR1_TLS, (void *) &state);
if (ret != PAPI_OK || state == NULL) {
state = (HighLevelInfo *) malloc(sizeof(HighLevelInfo));
if (state == NULL) return (PAPI_ESYS);
memset(state, 0, sizeof(HighLevelInfo));
state->EventSet = PAPI_NULL;
ret = PAPI_create_eventset(&state->EventSet);
if (ret != PAPI_OK) return (PAPI_ESYS);
ret = PAPI_set_thr_specific(PAPI_USR1_TLS, state);
if (ret != PAPI_OK) return (ret);
}
*
See Also:
PAPI_register_thread PAPI_thread_init PAPI_thread_id PAPI_set_thr_specific
Author
Generated automatically by Doxygen for PAPI from the source code.
Version 5.2.0.0 Tue Jun 17 2014 PAPI_get_thr_specific(3)