added a select loop for non-blocking shells