[env] enhance stack script, limit pwd stack to 10