Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

exit(3) [ultrix man page]

exit(3) 						     Library Functions Manual							   exit(3)

Name
       exit - terminate a process after flushing any pending output

Syntax
       void exit(status)
       int status;
       int atexit(func)
       void (*func)();

Description
       The  function  terminates  a process after calling the Standard I/O library function, _cleanup, to flush any buffered output.  The function
       never returns.

       The function registers a function to be called (without arguments) at normal program termination; functions are called in the reverse order
       of their registration (that is, most recent first). If a function is registered more than once, it will be called more than once.

Return Values
       The function returns zero if the registration succeeds, or -1 if the function pointer is null or if too many functions are registered.

See Also
       exit(2), intro(3s)

																	   exit(3)

Check Out this Related Man Page

EXIT(3) 						   BSD Library Functions Manual 						   EXIT(3)

NAME
exit, _Exit -- perform normal program termination LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> void exit(int status); void _Exit(int status); DESCRIPTION
The exit() and _Exit() functions terminate a process. Before termination, exit() performs the following functions in the order listed: 1. Call the functions registered with the atexit(3) function, in the reverse order of their registration. 2. Flush all open output streams. 3. Close all open streams. 4. Unlink all files created with the tmpfile(3) function. The _Exit() function terminates without calling the functions registered with the atexit(3) function, and may or may not perform the other actions listed. Both functions make the low-order eight bits of the status argument available to a parent process which has called a wait(2)-family function. The C Standard (ISO/IEC 9899:1999 (``ISO C99'')) defines the values 0, EXIT_SUCCESS, and EXIT_FAILURE as possible values of status. Cooper- ating processes may use other values; in a program which might be called by a mail transfer agent, the values described in sysexits(3) may be used to provide more information to the parent process. Note that exit() does nothing to prevent bottomless recursion should a function registered using atexit(3) itself call exit(). Such func- tions must call _Exit() instead (although this has other effects as well which may not be desired). RETURN VALUES
The exit() and _Exit() functions never return. SEE ALSO
_exit(2), wait(2), atexit(3), intro(3), sysexits(3), tmpfile(3) STANDARDS
The exit() and _Exit() functions conform to ISO/IEC 9899:1999 (``ISO C99''). BSD
September 9, 2002 BSD
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

exiting from a loop

I wonder if someone could help me here. I am trying to find a way of exiting from a loop but not exiting me from the script for example #!/bin/ksh # ************* FUNCTIONS ****************** function1() { #ping test ping $1 2 > /dev/null if ; then ... (13 Replies)
Discussion started by: hcclnoodles
13 Replies

2. UNIX and Linux Applications

Oracle return codes?

Having searched high and low through Oracles documentation, I came to think that they're very scripting-averse, as there's (apparently) no list of possible return/exit codes for their various command line utilities. Is anyone here in possession of such a list, or knows where to find one? It... (16 Replies)
Discussion started by: pludi
16 Replies

3. UNIX for Dummies Questions & Answers

exit a script

Hi Guys, I have a script which takes reply from user and executes the corresponding scirpt. Below is the script PS3 = 'Enter the options of your choice(x to exit)=>' select useropt in 'List Processess' \ 'List semaphores' do case $REPLY in 1) abc.sh ... (13 Replies)
Discussion started by: vandi
13 Replies

4. Shell Programming and Scripting

Exits from putty instead of shell script

Dear, I have written below code to initiate the log at top of my script. #Set the log file LOGFILE=<path>/<filename.log> exec > $LOGFILE 2>&1 ............... .... ... .. ............ echo -e "\n\n Script finished OK " `date "+%m/%d/%y %H:%M:%S" ` "\n\n" exit 0 the logging ends only... (14 Replies)
Discussion started by: Imran_Chennai
14 Replies

5. Solaris

Unable to install Sol10 on V245, exiting to shell.

Hi there, OK so I am super-green, but I have a problem I am hoping someone can help me with. I have a V245 that I am unable to install Solaris 10 (10/09) onto as during the initial install process, the UI pops up for region selection, but then as I enter my region, identify the system, up comes... (21 Replies)
Discussion started by: wallrunn3r
21 Replies

6. Shell Programming and Scripting

Unable to find exit status of piped command

Lois_Answer_Code=`sipsak -vv -s sip:192.168.1.3|grep -A 1 "reply received after"|grep SIP|awk '{print $2}'`How to find the exit status of | (12 Replies)
Discussion started by: proactiveaditya
12 Replies

7. Shell Programming and Scripting

confusion in use of exit 0

hi i am new to shell scripting. i was going thru the part option and arguments. on this section i fail to understand the use of exit 0 in below example . #!/bin/sh USAGE="Usage: $0 " case "$1" in -t) TARGS="-tvf $2" ;; -c) TARGS="-cvf $2.tar $2" ;; *) echo "$USAGE" exit 0 ;; esac... (13 Replies)
Discussion started by: scriptor
13 Replies

8. AIX

Screen blanks when exiting vi and more

I have just installed AIX 7.1 on a new system, and find that it displays the same annoying behaviour the you find in Linux: In an xterm, when you quit vim or less, the file listed in the terminal window is blanked out and replaced with whatever was there before. In vim there is a couple of... (12 Replies)
Discussion started by: jandersen
12 Replies

9. Shell Programming and Scripting

While Loop Exiting

We are trying to design a flow so that an ETL job shouldn't start until the previous job completes. The script we have written is while ; do sleep 2; done The loop however exits even when the process is actually running. Why could this be happening? (12 Replies)
Discussion started by: jerome_rajan
12 Replies

10. Shell Programming and Scripting

Grep for string and substitute if exits with a yes/no

Hi I have 3 files in total. file 1 is enriched.txt file2 is repressed.txt and file 3 is my content.txt What i need is query the content file against both enriched and repressed and wherever the gensymbol is same in both the files then add a yes value against it file1 Gene ABC XYZ MNO... (12 Replies)
Discussion started by: Diya123
12 Replies

11. Shell Programming and Scripting

To search the pattern on the basis of date and exit code

Hi, I am getting scheduler log file on daily basis from windows box which contains job status and corresponding date, date is in windows format. I wanted to write one script which will search the pattern (Exit code) for the today's date and if code is Zero then Job Success message should be... (14 Replies)
Discussion started by: ajju
14 Replies

12. Shell Programming and Scripting

[BASH] Script to manage background scripts (running, finished, exit code)

Heyas, Since this question (similar) occur every now and then, and given the fact i was thinking about it just recently (1-2 weeks) anyway, i started to write something :p The last point for motivation was... (17 Replies)
Discussion started by: sea
17 Replies

13. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies

14. Shell Programming and Scripting

Returning an exit code from a bash function

How to return a exit code from a function and use it in conditional? I tried the following but it does not seem to work. tests.sh: if test ./load.sh ; then echo "0" else echo "1" fi load.sh: return 1; from command line: $ ./tests.sh 0 I was expecting it to output "1"... (17 Replies)
Discussion started by: wolfv
17 Replies

15. Shell Programming and Scripting

Script Works But Need It to Exit Upon Closing Program

Running Xubuntu 16.04 with shell version "GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)," I have a working script that consistently renames a Chrome window: #!/bin/sh while sleep 1; do xdotool search --name chrome 2>/dev/null | while read id; do xdotool set_window --name... (21 Replies)
Discussion started by: jakefish
21 Replies