read command and quit function