"nice" command is returning value as 33. Please help me understand why nice is returning the value as 33. In some systems it works just fine giving return value as 0 but on a system it gives me return value as 33.
nice -n -10 <doing some process here>
returnValue=$?
Here returnValue gets a value as 33 in spite of 0.
It looks like nice(1)
is returning the exit code of the niced command*. Try
nice bash -c 'exit 13' ; echo $?
and you get 13. So your niced command got an exit
code of 33. We can't tell you how does that happen, because you don't tell what command are you nicing. BTW, some shells might have a nice builtin so you might use explicitly /usr/bin/nice
instead of nice
Note *: even when nice
fails (e.g. nice -n -12 id
without being root), it says something to stderr
but exit 0