Implement a fucntion of exists-commmand