Use array to keep output message.
Implement ps function.

refer to 510587