05-11-2010
Good one! I didn't think about using exit when i call the routine.
Thanks,
Nagarajan G
10 More Discussions You Might Find Interesting
1. Programming
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:\n", ret );
} (3 Replies)
Discussion started by: haiudhaya
3 Replies
2. Shell Programming and Scripting
I know how to get the returning code of a function but wonder if I can combine the follwoing two lines into one:
e.g.:
#!/bin/shell
...
#line 1
MyFunction arg1 arg 2
#line 2
rec=$? #this will be evaluated later
....
like in c/c++, we'd write one line:
rec=MyFunction(arg1, arg 2)
... (6 Replies)
Discussion started by: bluemoon1
6 Replies
3. Shell Programming and Scripting
i'm writing some simple scripts to help me learn perl.
why does the print command get called after the shell script is executed?
the purpose of the shell script is to simply echo to the screen "script run". which is does, but before the print command, you can clearly see the shell script is... (3 Replies)
Discussion started by: mjays
3 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'.
I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies
5. Shell Programming and Scripting
I am using a perl-script from C-code, executing it by the 'system(..)' comand.
The problem is to return the perl-return code to the C correctly.
Default the 'system()' shell is Bourne: sh
My try: (perl_src.c_pl - the perl script; t_sys - C-program with system() call (I will show it... (7 Replies)
Discussion started by: alex_5161
7 Replies
6. Shell Programming and Scripting
Hi everyone,
when executing this command in unix:
echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error.
here is content of my script:
tdbsrvr$ vi hc.sh
"hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies
7. UNIX for Dummies Questions & Answers
Hi
Is there any way GREP command can return word and not complete line.
My file has following data:
Hello Everyone I am NitinrajSrivastava
Hi Friends Welcome VrajSrivastava
I am using grep 'raj' which is returning me complete line.However I want only the word having keyword 'raj'.
Required... (11 Replies)
Discussion started by: dashing201
11 Replies
8. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
This subroutine needs to check if there was a file name given on the command line. If so, return that. Otherwise... (1 Reply)
Discussion started by: yonkers062986
1 Replies
9. Shell Programming and Scripting
i want to call subroutines in perl like:
sub temp
{ ---- some code ----- }
temp(-switchName, value1, --switchName2, value2)
Like i know getoptions::Long is there for command line switches type arguments. So i want to know for subroutine type arguments. (1 Reply)
Discussion started by: Navrattan Bansa
1 Replies
10. Red Hat
Hello all
I have a query (SQL) that returns a rather long field from an Oracle database. The field in question is defined on 400 characters but all these 400 cannot be displayed by the echo command. Thus when I launch the following command:
echo "SELECT FIELD01 FROM TABLE_NAME;" | sqlplus -s... (9 Replies)
Discussion started by: S. BASU
9 Replies
exit(2) System Calls Manual exit(2)
Name
_exit - terminate a process
Syntax
#include <stdlib.h>
void _exit(status)
int status;
Description
The function, terminates a calling process with the following consequences:
o All of the file descriptors open in the calling process are closed.
o If the parent process of the calling process is executing a it is notified of the calling process's termination and the low-order
eight bits of status are made available to it. For further information, see
o The parent process ID of all of the calling process's existing child processes and zombie processes are also set to 1. This means
that the initialization process inherits each of these processes as well. For further information, see
o Each attached shared memory segment is detached and the value of shm_nattach in the data structure associated with its shared memory
identifier is decremented by 1.
o For each semaphore for which the calling process has set a semadj value, (see ) that semadj value is added to the semval of the speci-
fied semaphore.
o If the process has a process, text, or data lock, an unlock is performed.
o An accounting record is written on the accounting file if the system's accounting routine is enabled. For more information, see
Calling directly circumvents all cleanup. Most C programs call the library routine which performs cleanup actions in the standard I/O
library before calling
Environment
POSIX, System V
The function differs from the System V as well as POSIX definition in that even if the calling process is a process group leader, the
SIGHUP signal is not sent to each process that has a process group ID equal to that of the calling process.
The function also differs in that the routine is declared as type int instead of type void.
See Also
fork(2), wait(2), exit(3), signal(3).
exit(2)