16

I would like to change the nice level of the currently running script:

#!/bin/bash

nice_it ( ) {
    nice
    ps -o "%p %r %y %x %n %c %a"
}

nice_it

That does not work, since nice tries to change the nice level of the command started by it.

Is it possible to achieve this in bash?

blueFast
  • 3,830
  • 12
  • 35
  • 49

1 Answers1

23

This is pretty trivial.

renice -n 10 $$
Michael Hampton
  • 232,086
  • 41
  • 459
  • 902