Update history before executing command