The current Bash has a nice value of 3.
Run nice -n 5 worker; assume the value remains in the ordinary range.
What nice value will worker normally have?
nice -n ADJUSTMENT adds a relative adjustment to the value inherited from the parent. Here 3 plus 5 produces 8.
Detailed explanation
Incorrect. 2 would subtract from the parent value.
Incorrect. 2 would subtract from the parent value.
Incorrect. 3 is the inherited value before the adjustment.
Incorrect. 3 is the inherited value before the adjustment.
Incorrect. 5 is the adjustment amount, not the resulting value.
Incorrect. 5 is the adjustment amount, not the resulting value.
Correct. The child starts at 3 + 5 = 8.
Correct. The child starts at 3 + 5 = 8.
Try it yourself
An example you can run in a temporary verification environment.
nice -n 3 nice -n 5 bash -c 'ps -o ni= -p "$$"'Expected result
8(呼出し元のnice値が0の場合)Key points
- nice -n is a relative adjustment
- The parent's value is inherited first
- Distinguish this from an absolute renice value
Notes
- Environment: GNU coreutils 9.x / procps-ng
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.