Linked Questions
18 questions linked to/from Default exit code when process is terminated?
176
votes
5
answers
71k
views
What exactly is POSIX?
I see POSIX mentioned often and everywhere, and I had assumed it to be the baseline UNIX standard.. until I noticed the following excerpt on a Wikipedia page: The Open Group
The Open Group is most ...
74
votes
4
answers
37k
views
What is the min and max values of exit codes in Linux?
What is the min and max values of the following exit codes in Linux:
The exit code returned from a binary executable (for example: a C
program).
The exit code returned from a bash script (when calling ...
70
votes
3
answers
258k
views
Exit code at the end of a bash script
I am confused about the meaning of the exit code in the end of a bash script:
I know that exit code 0 means that it finished successfully, and that there are many more exit codes numbers (127 if I'm ...
50
votes
1
answer
29k
views
What does a program do when it's sent SIGKILL signal?
When I used killall -9 name to kill a program, the state become zombie. Some minutes later, it stopped really.
So, what's happening during those minutes?
21
votes
5
answers
25k
views
Keep exit codes when trapping SIGINT and similar?
If I use trap like described e.g. on http://linuxcommand.org/wss0160.php#trap to catch ctrl-c (or similar) and cleanup before exiting then I am changing the exit code returned.
Now this probably won'...
25
votes
3
answers
21k
views
Implicit return in bash functions?
Say I have a bash function like so:
gmx(){
echo "foo";
}
will this function implicitly return the exit value of the echo command, or is using return necessary?
gmx(){
echo "foo";
return $?
}
I ...
14
votes
2
answers
7k
views
Is the "$?" (dollar-question mark) variable available only in the Bash shell?
In the Bash shell, I can get the command exit status through the $? variable:
# ps -ef | grep "haha"
root 15439 15345 0 23:02 pts/0 00:00:00 grep --color=auto haha
# echo $?
0
Is it ...
15
votes
1
answer
23k
views
Why is "Doing an exit 130 is not the same as dying of SIGINT"?
From Stéphane Chazelas's reply at https://unix.stackexchange.com/a/230568
Ideally, we'd want to report to our parent that we died of a SIGINT
(so that if it's another bash script for instance, ...
8
votes
2
answers
19k
views
Pipe Fail (141) when piping output into tee -- why?
An example should clarify my question. This behavior makes sense to me:
$ echo hi | cat
hi
$ echo hi | tee >(cat)
hi
hi
The first case is obvious. In the 2nd case, we pipe "hi" into tee using ...
Jonah's user avatar
- 1,059
2
votes
2
answers
17k
views
Check if there is a certain file in a directory
Hi I'm trying to do an if which gets a path to a directory as an argument and checks if file.txt is in the directory.And returns 1 if it is , 0 otherwise.
if [ -e 1ドル/file.txt ]; then
...
9
votes
2
answers
3k
views
Is Linux considered XSI compliant or largely so?
From APUE
The Single UNIX Specification, a superset of the POSIX.1 standard,
specifies additional interfaces that extend the functionality provided
by the POSIX.1 specification. POSIX.1 is ...
1
vote
1
answer
2k
views
How do you tell what the return code of a process is when it exits and where is the value usually documented?
If a process runs and exits it returns a non-zero status (personnaly I prefer the term return code); or even a zero status I know that the value is there (mostly because I've done C++ programming and ...
4
votes
1
answer
1k
views
Is it possible to determine the signal received by last running application?
From a shell, say Bash, is it possible to retrieve the signal number received by the application that most recently finished, if any, in a way that is similar to checking the return code of a process ...
1
vote
1
answer
1k
views
What is exit $? in shell script? [duplicate]
In shell-script, what is this command? exit $?
I didn't find any resource to explain it.
0
votes
2
answers
2k
views
Use waitpid for child having groupid 1
I searched a lot but didn't find a solution. So it can be silly question.
The format of waitpid is
pid_t waitpid (pid_t pid, int *status, int options)
The pid parameter specifies exactly which ...