What is the purpose of the $? variable in a shell script?
- It represents the process ID of the script.
- It stores the script's exit status.
- It contains the script's standard input.
- It holds the current working directory of the script.
The purpose of the $? variable in a shell script is to store the script's exit status. A value of 0 typically indicates success, while non-zero values indicate different types of errors or failures. This is essential for error checking and script control flow.
Loading...
Related Quiz
- The ________ command in Linux is used to send a signal to a process, often used for termination.
- To iterate over a range of numbers in a loop, one might use the seq command combined with the _________ loop.
- The _________ directory in Linux is typically used for transient or temporary data, often cleared during boot.
- The ________ command in Linux allows you to enforce a user to change their password upon the next login.
- When a process is neither in 'running' nor in 'blocked' state, which state might it be in?