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,000
  • 13
  • 36
  • 51

1 Answers1

24

This is pretty trivial.

renice -n 10 $$
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940