Executes a command and returns a scalar value from it