add --shell option plus improved error checking