Change nice level of currently running script

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?


Solution 1:

This is pretty trivial.

renice -n 10 $$