17

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
  • 4,200
  • 13
  • 37
  • 54

1 Answers1

25

This is pretty trivial.

renice -n 10 $$
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972