HP-UX Reference (11i v1 05/09) - 1 User Commands N-Z (vol 2)
n
nice(1) nice(1)
from a login shell whose current nice value is 20 spawns a subshell with a system nice value of 30.
Attempting to use
nice --2 ksh
from the new shell to spawn another subshell whose system nice value would be 28, is rejected (unless the
user has appropriate privileges), even though the resulting system nice value would be less than the prior-
ity of the original login shell process.
The system nice value for current processes is listed under the
NI column produced by the ps -l com-
mand (see ps(1)).
Background Processes
Foreground processes are run at same system nice value as the parent shell. Background processes
spawned by
ksh run at the equivalent of a
nice -4 by default. If a background process is started via
nice from ksh, any priority_change specified in the
nice command is added to default nice -4. Thus
the command
nice 12 command &
runs at a system nice value of 36 if executed from ksh.
EXTERNAL INFLUENCES
Environment Variables
LC_MESSAGES determines the language in which messages are displayed.
If LC_MESSAGES is not specified in the environment or is set to the empty string, the value of
LANG is
used as a default for each unspecified or empty variable. If
LANG is not specified or is set to the empty
string, a default of "C" (see lang(5)) is used instead of
LANG.
If any internationalization variable contains an invalid setting,
nice behaves as if all internationalization
variables are set to "C". See environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
nice returns the value returned by command.
EXAMPLES
The following examples assume the current process is running with a system nice value of 20 and
nice is
executed from the Korn shell (see ksh(1)).
Run a program named
prog in the current directory at the default priority_change of 10 (system nice
value of 30):
nice ./prog prog_args
Run the same program in the background using a system nice value of 36 (priority_change=12 plus 4 for
the Korn shell):
nice -12 ./prog prog_args &
As a user with appropriate privileges, run prog as a foreground process with a system nice value of 6:
nice --14 ./prog prog_args
WARNINGS
The C shell, csh, has a built-in nice command with different syntax. See csh(1) for details.
SEE ALSO
csh(1), ksh(1), nohup(1), sh-bourne(1), sh-posix(1), sh(1), renice(1M), nice(2).
STANDARDS CONFORMANCE
nice: SVID2, SVID3, XPG4
HP-UX 11i Version 1: September 2005 − 2 − Hewlett-Packard Company Section 1−−605