bash: make lastpid variable local