Start a new Bash command with nice value 10.
Do not change the nice value of the current shell.
Which command satisfies the requirement?
nice applies a nice value when it starts a new command. A positive value lowers CPU scheduling priority without changing the caller's shell.
Detailed explanation
renice --priority 10 --pid "$$"Incorrect. renice changes the current shell's priority rather than only the new command.
nohup bash -c 'ps -o ni= -p "$$"'Incorrect. nohup changes hangup handling but does not set a nice value.
nice -n -10 bash -c 'ps -o ni= -p "$$"'Incorrect. A negative nice value requests a higher priority and is the opposite of the requirement.
nice -n 10 bash -c 'ps -o ni= -p "$$"'Correct. nice starts the new Bash with nice value 10 while leaving the caller unchanged.
Try it yourself
An example you can run in a temporary verification environment.
printf 'parent='; ps -o ni= -p "$$"
nice -n 10 bash -c 'printf "child="; ps -o ni= -p "$$"'
printf 'parent-after='; ps -o ni= -p "$$"Expected result
parent= 0
child= 10
parent-after= 0
※表示の空白幅は環境により異なるKey points
- nice versus renice
- Positive nice values
- The scope of a newly started process
Notes
- Environment: Bash 5.2 / GNU coreutils 9.x
- 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.